lkml.org 
[lkml]   [2023]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 02/11] block: Block Device Filtering Mechanism
> +	struct request_queue *q = bdev_get_queue(bio->bi_bdev);
> + bool skip_bio = false;
> +
> + if (unlikely(bio_queue_enter(bio)))
> + return;
> +
> + if (bio->bi_bdev->bd_filter &&
> + bio->bi_bdev->bd_filter != current->blk_filter) {
> + struct blkfilter *prev = current->blk_filter;
> +
> + current->blk_filter = bio->bi_bdev->bd_filter;
> + skip_bio = bio->bi_bdev->bd_filter->ops->submit_bio(bio);
> + current->blk_filter = prev;
> + }
> +
> + blk_queue_exit(q);

This currently adds a queue enter/exit pair even if no filter driver
is used, which іs probably not acceptable. We probably need some
way to avoid the check in the fast path. In general an unlocked check
for bio->bi_bdev->bd_filter outside the protection seems fine to here,
we just need to find a good way to make sure it is visible by the
time a filter is actually set and the filter driver initialization.

> if (!bio->bi_bdev->bd_has_submit_bio) {
> blk_mq_submit_bio(bio);
> - } else if (likely(bio_queue_enter(bio) == 0)) {
> + return;
> + }
> +
> + if (likely(bio_queue_enter(bio) == 0)) {

This is just stray reformatting and we can drop it.

\
 
 \ /
  Last update: 2023-12-07 08:46    [W:0.158 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site