[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZXF33Q9TpF4kBXP0@infradead.org>
Date: Wed, 6 Dec 2023 23:44:29 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Sergei Shtepa <sergei.shtepa@...ux.dev>
Cc: axboe@...nel.dk, hch@...radead.org, corbet@....net,
snitzer@...nel.org, mingo@...hat.com, peterz@...radead.org,
juri.lelli@...hat.com, viro@...iv.linux.org.uk, brauner@...nel.org,
linux-block@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Sergei Shtepa <sergei.shtepa@...am.com>,
Donald Buczek <buczek@...gen.mpg.de>,
Fabio Fantoni <fantonifabio@...cali.it>
Subject: Re: [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.
Powered by blists - more mailing lists