* [PATCH 0/4] Zoned block device code refactoring
@ 2025-11-10 22:29 Bart Van Assche
2025-11-10 22:29 ` [PATCH 1/4] blk-zoned: Fix a typo in a source code comment Bart Van Assche
` (3 more replies)
0 siblings, 4 replies; 17+ messages in thread
From: Bart Van Assche @ 2025-11-10 22:29 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block, Christoph Hellwig, Bart Van Assche
Hi Jens,
This series includes four small patches for the zoned block device code: a typo
is fixed, a lockdep annotation is added and the code is made slightly easier to
follow. Please consider these patches for the next merge window.
Thanks,
Bart.
Bart Van Assche (4):
blk-zoned: Fix a typo in a source code comment
blk-zoned: Document disk_zone_wplug_schedule_bio_work() locking
blk-zoned: Split an if-statement
blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller
block/blk-zoned.c | 41 ++++++++++++++++++-----------------------
1 file changed, 18 insertions(+), 23 deletions(-)
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 1/4] blk-zoned: Fix a typo in a source code comment 2025-11-10 22:29 [PATCH 0/4] Zoned block device code refactoring Bart Van Assche @ 2025-11-10 22:29 ` Bart Van Assche 2025-11-11 1:49 ` Chaitanya Kulkarni ` (2 more replies) 2025-11-10 22:30 ` [PATCH 2/4] blk-zoned: Document disk_zone_wplug_schedule_bio_work() locking Bart Van Assche ` (2 subsequent siblings) 3 siblings, 3 replies; 17+ messages in thread From: Bart Van Assche @ 2025-11-10 22:29 UTC (permalink / raw) To: Jens Axboe Cc: linux-block, Christoph Hellwig, Bart Van Assche, Damien Le Moal Remove a superfluous parenthesis that was introduced by commit fa8555630b32 ("blk-zoned: Improve the queue reference count strategy documentation"). Cc: Damien Le Moal <dlemoal@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- block/blk-zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 3791755bc6ad..57ab2b365c2d 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -730,7 +730,7 @@ static inline void blk_zone_wplug_bio_io_error(struct blk_zone_wplug *zwplug, bio_clear_flag(bio, BIO_ZONE_WRITE_PLUGGING); bio_io_error(bio); disk_put_zone_wplug(zwplug); - /* Drop the reference taken by disk_zone_wplug_add_bio(() */ + /* Drop the reference taken by disk_zone_wplug_add_bio(). */ blk_queue_exit(q); } ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/4] blk-zoned: Fix a typo in a source code comment 2025-11-10 22:29 ` [PATCH 1/4] blk-zoned: Fix a typo in a source code comment Bart Van Assche @ 2025-11-11 1:49 ` Chaitanya Kulkarni 2025-11-11 7:06 ` Damien Le Moal 2025-11-11 7:49 ` Christoph Hellwig 2 siblings, 0 replies; 17+ messages in thread From: Chaitanya Kulkarni @ 2025-11-11 1:49 UTC (permalink / raw) To: Bart Van Assche, Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig, Damien Le Moal On 11/10/25 14:29, Bart Van Assche wrote: > Remove a superfluous parenthesis that was introduced by commit fa8555630b32 > ("blk-zoned: Improve the queue reference count strategy documentation"). > > Cc: Damien Le Moal<dlemoal@kernel.org> > Cc: Christoph Hellwig<hch@lst.de> > Signed-off-by: Bart Van Assche<bvanassche@acm.org> Looks good. Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> -ck ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/4] blk-zoned: Fix a typo in a source code comment 2025-11-10 22:29 ` [PATCH 1/4] blk-zoned: Fix a typo in a source code comment Bart Van Assche 2025-11-11 1:49 ` Chaitanya Kulkarni @ 2025-11-11 7:06 ` Damien Le Moal 2025-11-11 7:49 ` Christoph Hellwig 2 siblings, 0 replies; 17+ messages in thread From: Damien Le Moal @ 2025-11-11 7:06 UTC (permalink / raw) To: Bart Van Assche, Jens Axboe; +Cc: linux-block, Christoph Hellwig On 11/11/25 7:29 AM, Bart Van Assche wrote: > Remove a superfluous parenthesis that was introduced by commit fa8555630b32 > ("blk-zoned: Improve the queue reference count strategy documentation"). > > Cc: Damien Le Moal <dlemoal@kernel.org> > Cc: Christoph Hellwig <hch@lst.de> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/4] blk-zoned: Fix a typo in a source code comment 2025-11-10 22:29 ` [PATCH 1/4] blk-zoned: Fix a typo in a source code comment Bart Van Assche 2025-11-11 1:49 ` Chaitanya Kulkarni 2025-11-11 7:06 ` Damien Le Moal @ 2025-11-11 7:49 ` Christoph Hellwig 2025-11-11 20:29 ` Bart Van Assche 2 siblings, 1 reply; 17+ messages in thread From: Christoph Hellwig @ 2025-11-11 7:49 UTC (permalink / raw) To: Bart Van Assche Cc: Jens Axboe, linux-block, Christoph Hellwig, Damien Le Moal On Mon, Nov 10, 2025 at 02:29:59PM -0800, Bart Van Assche wrote: > Remove a superfluous parenthesis that was introduced by commit fa8555630b32 > ("blk-zoned: Improve the queue reference count strategy documentation"). Or just drop the pointless parenthesis entirely? ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/4] blk-zoned: Fix a typo in a source code comment 2025-11-11 7:49 ` Christoph Hellwig @ 2025-11-11 20:29 ` Bart Van Assche 0 siblings, 0 replies; 17+ messages in thread From: Bart Van Assche @ 2025-11-11 20:29 UTC (permalink / raw) To: Christoph Hellwig; +Cc: Jens Axboe, linux-block, Damien Le Moal On 11/10/25 11:49 PM, Christoph Hellwig wrote: > On Mon, Nov 10, 2025 at 02:29:59PM -0800, Bart Van Assche wrote: >> Remove a superfluous parenthesis that was introduced by commit fa8555630b32 >> ("blk-zoned: Improve the queue reference count strategy documentation"). > > Or just drop the pointless parenthesis entirely? Hi Christoph, The parentheses make it clear that disk_zone_wplug_add_bio() is the name of a function and not the name of a variable. Thanks, Bart. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/4] blk-zoned: Document disk_zone_wplug_schedule_bio_work() locking 2025-11-10 22:29 [PATCH 0/4] Zoned block device code refactoring Bart Van Assche 2025-11-10 22:29 ` [PATCH 1/4] blk-zoned: Fix a typo in a source code comment Bart Van Assche @ 2025-11-10 22:30 ` Bart Van Assche 2025-11-11 1:49 ` Chaitanya Kulkarni 2025-11-11 7:07 ` Damien Le Moal 2025-11-10 22:30 ` [PATCH 3/4] blk-zoned: Split an if-statement Bart Van Assche 2025-11-10 22:30 ` [PATCH 4/4] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller Bart Van Assche 3 siblings, 2 replies; 17+ messages in thread From: Bart Van Assche @ 2025-11-10 22:30 UTC (permalink / raw) To: Jens Axboe Cc: linux-block, Christoph Hellwig, Bart Van Assche, Damien Le Moal Document that all callers hold this lock because the code in disk_zone_wplug_schedule_bio_work() depends on this. Cc: Damien Le Moal <dlemoal@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- block/blk-zoned.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 57ab2b365c2d..5487d5eb2650 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -1188,6 +1188,8 @@ void blk_zone_mgmt_bio_endio(struct bio *bio) static void disk_zone_wplug_schedule_bio_work(struct gendisk *disk, struct blk_zone_wplug *zwplug) { + lockdep_assert_held(&zwplug->lock); + /* * 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 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 2/4] blk-zoned: Document disk_zone_wplug_schedule_bio_work() locking 2025-11-10 22:30 ` [PATCH 2/4] blk-zoned: Document disk_zone_wplug_schedule_bio_work() locking Bart Van Assche @ 2025-11-11 1:49 ` Chaitanya Kulkarni 2025-11-11 7:07 ` Damien Le Moal 1 sibling, 0 replies; 17+ messages in thread From: Chaitanya Kulkarni @ 2025-11-11 1:49 UTC (permalink / raw) To: Bart Van Assche, Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig, Damien Le Moal On 11/10/25 14:30, Bart Van Assche wrote: > Document that all callers hold this lock because the code in > disk_zone_wplug_schedule_bio_work() depends on this. > > Cc: Damien Le Moal<dlemoal@kernel.org> > Cc: Christoph Hellwig<hch@lst.de> > Signed-off-by: Bart Van Assche<bvanassche@acm.org> Looks good. Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> -ck ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/4] blk-zoned: Document disk_zone_wplug_schedule_bio_work() locking 2025-11-10 22:30 ` [PATCH 2/4] blk-zoned: Document disk_zone_wplug_schedule_bio_work() locking Bart Van Assche 2025-11-11 1:49 ` Chaitanya Kulkarni @ 2025-11-11 7:07 ` Damien Le Moal 1 sibling, 0 replies; 17+ messages in thread From: Damien Le Moal @ 2025-11-11 7:07 UTC (permalink / raw) To: Bart Van Assche, Jens Axboe; +Cc: linux-block, Christoph Hellwig On 11/11/25 7:30 AM, Bart Van Assche wrote: > Document that all callers hold this lock because the code in > disk_zone_wplug_schedule_bio_work() depends on this. > > Cc: Damien Le Moal <dlemoal@kernel.org> > Cc: Christoph Hellwig <hch@lst.de> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/4] blk-zoned: Split an if-statement 2025-11-10 22:29 [PATCH 0/4] Zoned block device code refactoring Bart Van Assche 2025-11-10 22:29 ` [PATCH 1/4] blk-zoned: Fix a typo in a source code comment Bart Van Assche 2025-11-10 22:30 ` [PATCH 2/4] blk-zoned: Document disk_zone_wplug_schedule_bio_work() locking Bart Van Assche @ 2025-11-10 22:30 ` Bart Van Assche 2025-11-11 1:50 ` Chaitanya Kulkarni 2025-11-11 7:09 ` Damien Le Moal 2025-11-10 22:30 ` [PATCH 4/4] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller Bart Van Assche 3 siblings, 2 replies; 17+ messages in thread From: Bart Van Assche @ 2025-11-10 22:30 UTC (permalink / raw) To: Jens Axboe Cc: linux-block, Christoph Hellwig, Bart Van Assche, Damien Le Moal Split an if-statement and also the comment above that if-statement. This patch makes the code slightly easier to read. No functionality has been changed. Cc: Damien Le Moal <dlemoal@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- block/blk-zoned.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 5487d5eb2650..73c7358ec184 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -1461,13 +1461,14 @@ static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs) bio_set_flag(bio, BIO_ZONE_WRITE_PLUGGING); /* - * If the zone is already plugged, add the BIO to the plug BIO list. - * Do the same for REQ_NOWAIT BIOs to ensure that we will not see a + * Add REQ_NOWAIT BIOs to the plug list to ensure that we will not see a * BLK_STS_AGAIN failure if we let the BIO execute. - * Otherwise, plug and let the BIO execute. */ - if ((zwplug->flags & BLK_ZONE_WPLUG_PLUGGED) || - (bio->bi_opf & REQ_NOWAIT)) + if (bio->bi_opf & REQ_NOWAIT) + goto plug; + + /* If the zone is already plugged, add the BIO to the BIO plug list. */ + if (zwplug->flags & BLK_ZONE_WPLUG_PLUGGED) goto plug; if (!blk_zone_wplug_prepare_bio(zwplug, bio)) { @@ -1476,6 +1477,7 @@ static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs) return true; } + /* Otherwise, plug and let the caller submit the BIO. */ zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; spin_unlock_irqrestore(&zwplug->lock, flags); ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 3/4] blk-zoned: Split an if-statement 2025-11-10 22:30 ` [PATCH 3/4] blk-zoned: Split an if-statement Bart Van Assche @ 2025-11-11 1:50 ` Chaitanya Kulkarni 2025-11-11 7:09 ` Damien Le Moal 1 sibling, 0 replies; 17+ messages in thread From: Chaitanya Kulkarni @ 2025-11-11 1:50 UTC (permalink / raw) To: Bart Van Assche, Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig, Damien Le Moal On 11/10/25 14:30, Bart Van Assche wrote: > Split an if-statement and also the comment above that if-statement. This > patch makes the code slightly easier to read. No functionality has been > changed. > > Cc: Damien Le Moal<dlemoal@kernel.org> > Cc: Christoph Hellwig<hch@lst.de> > Signed-off-by: Bart Van Assche<bvanassche@acm.org> Looks good. Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> -ck ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/4] blk-zoned: Split an if-statement 2025-11-10 22:30 ` [PATCH 3/4] blk-zoned: Split an if-statement Bart Van Assche 2025-11-11 1:50 ` Chaitanya Kulkarni @ 2025-11-11 7:09 ` Damien Le Moal 2025-11-11 7:50 ` Christoph Hellwig 1 sibling, 1 reply; 17+ messages in thread From: Damien Le Moal @ 2025-11-11 7:09 UTC (permalink / raw) To: Bart Van Assche, Jens Axboe; +Cc: linux-block, Christoph Hellwig On 11/11/25 7:30 AM, Bart Van Assche wrote: > Split an if-statement and also the comment above that if-statement. This > patch makes the code slightly easier to read. No functionality has been > changed. > > Cc: Damien Le Moal <dlemoal@kernel.org> > Cc: Christoph Hellwig <hch@lst.de> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Though it feels like this should be squashed with patch 4/4. -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/4] blk-zoned: Split an if-statement 2025-11-11 7:09 ` Damien Le Moal @ 2025-11-11 7:50 ` Christoph Hellwig 0 siblings, 0 replies; 17+ messages in thread From: Christoph Hellwig @ 2025-11-11 7:50 UTC (permalink / raw) To: Damien Le Moal Cc: Bart Van Assche, Jens Axboe, linux-block, Christoph Hellwig On Tue, Nov 11, 2025 at 04:09:10PM +0900, Damien Le Moal wrote: > On 11/11/25 7:30 AM, Bart Van Assche wrote: > > Split an if-statement and also the comment above that if-statement. This > > patch makes the code slightly easier to read. No functionality has been > > changed. > > > > Cc: Damien Le Moal <dlemoal@kernel.org> > > Cc: Christoph Hellwig <hch@lst.de> > > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > > Reviewed-by: Damien Le Moal <dlemoal@kernel.org> > > Though it feels like this should be squashed with patch 4/4. Yes, please. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4/4] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller 2025-11-10 22:29 [PATCH 0/4] Zoned block device code refactoring Bart Van Assche ` (2 preceding siblings ...) 2025-11-10 22:30 ` [PATCH 3/4] blk-zoned: Split an if-statement Bart Van Assche @ 2025-11-10 22:30 ` Bart Van Assche 2025-11-11 7:16 ` Damien Le Moal 2025-11-11 7:53 ` Christoph Hellwig 3 siblings, 2 replies; 17+ messages in thread From: Bart Van Assche @ 2025-11-10 22:30 UTC (permalink / raw) To: Jens Axboe Cc: linux-block, Christoph Hellwig, Bart Van Assche, Damien Le Moal Move the following code into the only caller of disk_zone_wplug_add_bio(): - The code for clearing the REQ_NOWAIT flag. - The code that sets the BLK_ZONE_WPLUG_PLUGGED flag. - The disk_zone_wplug_schedule_bio_work() call. This patch moves all code that is related to REQ_NOWAIT or to bio scheduling into a single function. No functionality has been changed. Cc: Damien Le Moal <dlemoal@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- block/blk-zoned.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 73c7358ec184..bff953416ffc 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -1204,8 +1204,6 @@ static inline void disk_zone_wplug_add_bio(struct gendisk *disk, struct blk_zone_wplug *zwplug, struct bio *bio, unsigned int nr_segs) { - bool schedule_bio_work = false; - /* * Grab an extra reference on the BIO request queue usage counter. * This reference will be reused to submit a request for the BIO for @@ -1221,16 +1219,6 @@ static inline void disk_zone_wplug_add_bio(struct gendisk *disk, */ bio_clear_polled(bio); - /* - * REQ_NOWAIT BIOs are always handled using the zone write plug BIO - * work, which can block. So clear the REQ_NOWAIT flag and schedule the - * work if this is the first BIO we are plugging. - */ - if (bio->bi_opf & REQ_NOWAIT) { - schedule_bio_work = !(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED); - bio->bi_opf &= ~REQ_NOWAIT; - } - /* * Reuse the poll cookie field to store the number of segments when * split to the hardware limits. @@ -1246,11 +1234,6 @@ static inline void disk_zone_wplug_add_bio(struct gendisk *disk, bio_list_add(&zwplug->bio_list, bio); trace_disk_zone_wplug_add_bio(zwplug->disk->queue, zwplug->zone_no, bio->bi_iter.bi_sector, bio_sectors(bio)); - - zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; - - if (schedule_bio_work) - disk_zone_wplug_schedule_bio_work(disk, zwplug); } /* @@ -1418,6 +1401,7 @@ static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs) { struct gendisk *disk = bio->bi_bdev->bd_disk; sector_t sector = bio->bi_iter.bi_sector; + bool schedule_bio_work = false; struct blk_zone_wplug *zwplug; gfp_t gfp_mask = GFP_NOIO; unsigned long flags; @@ -1464,8 +1448,10 @@ static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs) * Add REQ_NOWAIT BIOs to the plug list to ensure that we will not see a * BLK_STS_AGAIN failure if we let the BIO execute. */ - if (bio->bi_opf & REQ_NOWAIT) + if (bio->bi_opf & REQ_NOWAIT) { + bio->bi_opf &= ~REQ_NOWAIT; goto plug; + } /* If the zone is already plugged, add the BIO to the BIO plug list. */ if (zwplug->flags & BLK_ZONE_WPLUG_PLUGGED) @@ -1485,7 +1471,12 @@ static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs) return false; plug: + schedule_bio_work = !(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED); + zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; + disk_zone_wplug_add_bio(disk, zwplug, bio, nr_segs); + if (schedule_bio_work) + disk_zone_wplug_schedule_bio_work(disk, zwplug); spin_unlock_irqrestore(&zwplug->lock, flags); ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 4/4] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller 2025-11-10 22:30 ` [PATCH 4/4] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller Bart Van Assche @ 2025-11-11 7:16 ` Damien Le Moal 2025-11-11 7:53 ` Christoph Hellwig 1 sibling, 0 replies; 17+ messages in thread From: Damien Le Moal @ 2025-11-11 7:16 UTC (permalink / raw) To: Bart Van Assche, Jens Axboe; +Cc: linux-block, Christoph Hellwig On 11/11/25 7:30 AM, Bart Van Assche wrote: > Move the following code into the only caller of disk_zone_wplug_add_bio(): > - The code for clearing the REQ_NOWAIT flag. > - The code that sets the BLK_ZONE_WPLUG_PLUGGED flag. > - The disk_zone_wplug_schedule_bio_work() call. > > This patch moves all code that is related to REQ_NOWAIT or to bio > scheduling into a single function. No functionality has been changed. > > Cc: Damien Le Moal <dlemoal@kernel.org> > Cc: Christoph Hellwig <hch@lst.de> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> [...] > @@ -1464,8 +1448,10 @@ static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs) > * Add REQ_NOWAIT BIOs to the plug list to ensure that we will not see a > * BLK_STS_AGAIN failure if we let the BIO execute. > */ > - if (bio->bi_opf & REQ_NOWAIT) > + if (bio->bi_opf & REQ_NOWAIT) { > + bio->bi_opf &= ~REQ_NOWAIT; > goto plug; > + } > > /* If the zone is already plugged, add the BIO to the BIO plug list. */ > if (zwplug->flags & BLK_ZONE_WPLUG_PLUGGED) The goto in this if should be "goto add_bio;" > @@ -1485,7 +1471,12 @@ static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs) > return false; > > plug: > + schedule_bio_work = !(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED); > + zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; > + And the label "add_bio" defined here. That would be cleaner I think. > disk_zone_wplug_add_bio(disk, zwplug, bio, nr_segs); > + if (schedule_bio_work) > + disk_zone_wplug_schedule_bio_work(disk, zwplug); > > spin_unlock_irqrestore(&zwplug->lock, flags); > -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/4] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller 2025-11-10 22:30 ` [PATCH 4/4] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller Bart Van Assche 2025-11-11 7:16 ` Damien Le Moal @ 2025-11-11 7:53 ` Christoph Hellwig 2025-11-11 20:51 ` Bart Van Assche 1 sibling, 1 reply; 17+ messages in thread From: Christoph Hellwig @ 2025-11-11 7:53 UTC (permalink / raw) To: Bart Van Assche Cc: Jens Axboe, linux-block, Christoph Hellwig, Damien Le Moal On Mon, Nov 10, 2025 at 02:30:02PM -0800, Bart Van Assche wrote: > plug: > + schedule_bio_work = !(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED); > + zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; > + > disk_zone_wplug_add_bio(disk, zwplug, bio, nr_segs); > + if (schedule_bio_work) > + disk_zone_wplug_schedule_bio_work(disk, zwplug); Given that the new disk_zone_wplug_add_bio does not touch BLK_ZONE_WPLUG_PLUGGED, this reads odd. Why not: disk_zone_wplug_add_bio(disk, zwplug, bio, nr_segs); if (!(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED)) { zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; disk_zone_wplug_schedule_bio_work(disk, zwplug); } and do away with the extra variable? ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/4] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller 2025-11-11 7:53 ` Christoph Hellwig @ 2025-11-11 20:51 ` Bart Van Assche 0 siblings, 0 replies; 17+ messages in thread From: Bart Van Assche @ 2025-11-11 20:51 UTC (permalink / raw) To: Christoph Hellwig; +Cc: Jens Axboe, linux-block, Damien Le Moal On 11/10/25 11:53 PM, Christoph Hellwig wrote: > On Mon, Nov 10, 2025 at 02:30:02PM -0800, Bart Van Assche wrote: >> plug: >> + schedule_bio_work = !(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED); >> + zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; >> + >> disk_zone_wplug_add_bio(disk, zwplug, bio, nr_segs); >> + if (schedule_bio_work) >> + disk_zone_wplug_schedule_bio_work(disk, zwplug); > > Given that the new disk_zone_wplug_add_bio does not touch > BLK_ZONE_WPLUG_PLUGGED, this reads odd. Why not: > > disk_zone_wplug_add_bio(disk, zwplug, bio, nr_segs); > if (!(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED)) { > zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; > disk_zone_wplug_schedule_bio_work(disk, zwplug); > } > > and do away with the extra variable? That looks like an interesting suggestion to me. I will integrate the above change in this patch series if it passes my tests. Thanks, Bart. ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2025-11-11 20:51 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-11-10 22:29 [PATCH 0/4] Zoned block device code refactoring Bart Van Assche 2025-11-10 22:29 ` [PATCH 1/4] blk-zoned: Fix a typo in a source code comment Bart Van Assche 2025-11-11 1:49 ` Chaitanya Kulkarni 2025-11-11 7:06 ` Damien Le Moal 2025-11-11 7:49 ` Christoph Hellwig 2025-11-11 20:29 ` Bart Van Assche 2025-11-10 22:30 ` [PATCH 2/4] blk-zoned: Document disk_zone_wplug_schedule_bio_work() locking Bart Van Assche 2025-11-11 1:49 ` Chaitanya Kulkarni 2025-11-11 7:07 ` Damien Le Moal 2025-11-10 22:30 ` [PATCH 3/4] blk-zoned: Split an if-statement Bart Van Assche 2025-11-11 1:50 ` Chaitanya Kulkarni 2025-11-11 7:09 ` Damien Le Moal 2025-11-11 7:50 ` Christoph Hellwig 2025-11-10 22:30 ` [PATCH 4/4] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller Bart Van Assche 2025-11-11 7:16 ` Damien Le Moal 2025-11-11 7:53 ` Christoph Hellwig 2025-11-11 20:51 ` Bart Van Assche
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.