All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Damien Le Moal <dlemoal@kernel.org>, Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v21 07/12] blk-zoned: Support pipelining of zoned writes
Date: Fri, 18 Jul 2025 09:29:53 -0700	[thread overview]
Message-ID: <e51d282f-b07a-4c4d-b83d-b4fb5061ba12@acm.org> (raw)
In-Reply-To: <bde0f755-eb69-4799-a9dd-35bf330f78ab@kernel.org>

On 7/18/25 12:38 AM, Damien Le Moal wrote:
> On 7/18/25 05:58, Bart Van Assche wrote:
>> @@ -768,14 +771,19 @@ static bool blk_zone_wplug_handle_reset_all(struct bio *bio)
>>   static void disk_zone_wplug_schedule_bio_work(struct gendisk *disk,
>>   					      struct blk_zone_wplug *zwplug)
>>   {
>> +	lockdep_assert_held(&zwplug->lock);
> 
> Unrelated change. Please move this to a prep patch.

I will drop this change since I don't really need this change.

>> +
>>   	/*
>>   	 * Take a reference on the zone write plug and schedule the submission
>>   	 * of the next plugged BIO. blk_zone_wplug_bio_work() will release the
>>   	 * reference we take here.
>>   	 */
>> -	WARN_ON_ONCE(!(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED));
> 
> Why do you remove this warning ?

This warning probably can be retained. I will look into restoring it.

>> @@ -972,9 +980,12 @@ static bool blk_zone_wplug_prepare_bio(struct blk_zone_wplug *zwplug,
>>   	return true;
>>   }
>>   
>> -static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs)
>> +static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs,
>> +					int from_cpu)
>>   {
>>   	struct gendisk *disk = bio->bi_bdev->bd_disk;
>> +	const bool ordered_hwq = bio_op(bio) != REQ_OP_ZONE_APPEND &&
>> +		disk->queue->limits.features & BLK_FEAT_ORDERED_HWQ;
> 
> This is not correct. If the BIO is a zone append and
> blk_zone_wplug_handle_write() is called, it means that we need to handle the BIO
> using zone append emulation, that is, the BIO will be a regular write. So you
> must treat it as if it originally was a regular write.

Hmm ... my understanding is that zone append emulation and also the
conversion of REQ_OP_ZONE_APPEND into REQ_OP_WRITE happens after the
above code has been executed, namely by blk_zone_wplug_prepare_bio().
 From that function:

	[ ... ]
	if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
		bio->bi_opf &= ~REQ_OP_MASK;
		bio->bi_opf |= REQ_OP_WRITE | REQ_NOMERGE;
	[ ... ]

Did I perhaps misunderstand your comment?

>> +	if (refcount_read(&zwplug->ref) == 2)
>> +		zwplug->from_cpu = -1;
> 
> This needs a comment explaining why you use the plug ref count instead of
> unconditionally clearing from_cpu.

I'm considering to add the following comment:

  	/*
	 * zwplug->from_cpu must not change while one or more writes are pending
	 * for the zone associated with zwplug. zwplug->ref is 2 when the plug
	 * is unused (one reference taken when the plug was allocated and
	 * another reference taken by the caller context). Reset
	 * zwplug->from_cpu if no more writes are pending.
	 */

Thanks,

Bart.

  reply	other threads:[~2025-07-18 16:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 20:57 [PATCH v21 00/12] Improve write performance for zoned UFS devices Bart Van Assche
2025-07-17 20:57 ` [PATCH v21 01/12] block: Support block devices that preserve the order of write requests Bart Van Assche
2025-07-17 20:57 ` [PATCH v21 02/12] blk-mq: Restore the zone write order when requeuing Bart Van Assche
2025-07-17 20:57 ` [PATCH v21 03/12] blk-zoned: Add an argument to blk_zone_plug_bio() Bart Van Assche
2025-07-18  7:13   ` Damien Le Moal
2025-07-18 15:54     ` Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 04/12] blk-zoned: Split an if-statement Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 05/12] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller Bart Van Assche
2025-07-18  7:15   ` Damien Le Moal
2025-07-17 20:58 ` [PATCH v21 06/12] blk-zoned: Introduce a loop in blk_zone_wplug_bio_work() Bart Van Assche
2025-07-18  7:17   ` Damien Le Moal
2025-07-17 20:58 ` [PATCH v21 07/12] blk-zoned: Support pipelining of zoned writes Bart Van Assche
2025-07-18  7:38   ` Damien Le Moal
2025-07-18 16:29     ` Bart Van Assche [this message]
2025-07-17 20:58 ` [PATCH v21 08/12] scsi: core: Retry unaligned " Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 09/12] scsi: sd: Increase retry count for " Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 10/12] scsi: scsi_debug: Add the preserves_write_order module parameter Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 11/12] scsi: scsi_debug: Support injecting unaligned write errors Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 12/12] ufs: core: Inform the block layer about write ordering Bart Van Assche
2025-07-18  7:08 ` [PATCH v21 00/12] Improve write performance for zoned UFS devices Damien Le Moal
2025-07-18 18:30   ` Bart Van Assche
2025-07-22  1:36     ` Damien Le Moal
2025-07-22 18:24       ` Bart Van Assche
2025-07-18  7:39 ` Damien Le Moal
2025-07-18 16:32   ` Bart Van Assche

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=e51d282f-b07a-4c4d-b83d-b4fb5061ba12@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.