From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@infradead.org>
Cc: Pankaj Raghav <p.raghav@samsung.com>,
linux-block@vger.kernel.org, gost.dev@samsung.com
Subject: Re: [PATCH 1/2] block: modify blk_mq_plug() to allow only reads for zoned block devices
Date: Wed, 28 Sep 2022 08:35:18 +0900 [thread overview]
Message-ID: <814b8ccd-7047-f7f7-25a9-0f7c1c293ce6@opensource.wdc.com> (raw)
In-Reply-To: <038d0238-19e0-70ff-49b6-b9c8f4429ac1@kernel.dk>
On 9/28/22 08:12, Jens Axboe wrote:
> On 9/27/22 5:07 PM, Damien Le Moal wrote:
>> On 9/28/22 01:52, Jens Axboe wrote:
>>> On 9/27/22 10:51 AM, Christoph Hellwig wrote:
>>>> On Tue, Sep 27, 2022 at 10:04:19AM -0600, Jens Axboe wrote:
>>>>> Ah yes, good point. We used to have this notion of 'fs' request, don't
>>>>> think we do anymore. Because it really should just be:
>>>>
>>>> A fs request is a !passthrough request.
>>>
>>> Right, that's the condition I made below too.
>>>
>>>>> if (zoned && (op & REQ_OP_WRITE) && fs_request)
>>>>> return NULL;
>>>>>
>>>>> for that condition imho. I guess we could make it:
>>>>>
>>>>> if (zoned && (op & REQ_OP_WRITE) && !(op & REQ_OP_DRV_OUT))
>>>>> return NULL;
>>>>
>>>> Well, the only opcodes we do zone locking for is REQ_OP_WRITE and
>>>> REQ_OP_WRITE_ZEROES. So this should be:
>>>>
>>>> if (zoned && (op == REQ_OP_WRITE || op == REQ_OP_WRITE_ZEROES))
>>>> return NULL;
>>>
>>> I'd rather just make it explicit and use that. Pankaj, do you want
>>> to spin a v2 with that?
>>
>> It would be nice to reuse the bio equivalent of
>> blk_req_needs_zone_write_lock().
>>
>> The test would be:
>>
>> if (bio_needs_zone_write_locking())
>> return NULL;
>>
>> With something like:
>>
>> static inline bool bio_needs_zone_write_locking()
>> {
>> if (!bdev_is_zoned(bio->bi_bdev))
>> return false;
>>
>> switch (bio_op(bio)) {
>> case REQ_OP_WRITE_ZEROES:
>>
>> case REQ_OP_WRITE:
>>
>> return true;
>> default:
>>
>> return false;
>>
>> }
>> }
>
> I'd be fine with that (using a shared helper), but let's please just
> make it:
>
> static inline bool op_is_zoned_write(bdev, op)
> {
> if (!bdev_is_zoned(bio->bi_bdev))
> return false;
>
> return op == REQ_OP_WRITE_ZEROES || op == REQ_OP_WRITE;
Works for me. Nit: should have REQ_OP_WRITE first as that is the most
common case.
> }
>
> and avoid a switch for this basic case and name it a bit more logically
> too. Not married to the above name, but the helper should not imply
> anything about zone locking. That's for the caller.
blk_req_needs_zone_write_lock() would become:
bool blk_req_needs_zone_write_lock(struct request *rq)
{
if (blk_rq_is_passthrough(rq))
return false;
if (!rq->q->disk->seq_zones_wlock)
return false;
return op_is_zoned_write(rq->q->disk->part0, req_op(rq));
}
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2022-09-27 23:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220925185349eucas1p1dc689bac64668ca038ba8646c44fd580@eucas1p1.samsung.com>
2022-09-25 18:53 ` [PATCH 0/2] enable plugging only for reads in zoned block devices Pankaj Raghav
[not found] ` <CGME20220925185350eucas1p1fc354429027a88de7e548a3a4529b4ef@eucas1p1.samsung.com>
2022-09-25 18:53 ` [PATCH 1/2] block: modify blk_mq_plug() to allow only reads for " Pankaj Raghav
2022-09-25 22:55 ` Damien Le Moal
2022-09-26 14:37 ` Christoph Hellwig
2022-09-26 14:40 ` Jens Axboe
2022-09-26 14:43 ` Christoph Hellwig
2022-09-26 16:32 ` Jens Axboe
2022-09-26 19:20 ` Pankaj Raghav
2022-09-26 19:25 ` Jens Axboe
2022-09-27 15:20 ` Pankaj Raghav
2022-09-27 16:04 ` Jens Axboe
2022-09-27 16:51 ` Christoph Hellwig
2022-09-27 16:52 ` Jens Axboe
2022-09-27 23:07 ` Damien Le Moal
2022-09-27 23:10 ` Damien Le Moal
2022-09-27 23:13 ` Jens Axboe
2022-09-27 23:12 ` Jens Axboe
2022-09-27 23:35 ` Damien Le Moal [this message]
2022-09-28 11:57 ` Pankaj Raghav
2022-09-28 22:19 ` Damien Le Moal
[not found] ` <CGME20220925185351eucas1p1e0c37396c09611509c0b18bdcdeddfe1@eucas1p1.samsung.com>
2022-09-25 18:53 ` [PATCH 2/2] block: use blk_mq_plug() in blk_execute_rq_nowait() Pankaj Raghav
2022-09-25 22:56 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=814b8ccd-7047-f7f7-25a9-0f7c1c293ce6@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=axboe@kernel.dk \
--cc=gost.dev@samsung.com \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=p.raghav@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).