On 7/18/25 05:58, 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. > > No functionality has been changed. > > This patch prepares for zoned write pipelining by removing the code from > disk_zone_wplug_add_bio() that does not apply to all zoned write pipelining > bio processing cases. > > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> [...] > @@ -993,6 +976,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; > @@ -1039,12 +1023,16 @@ 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) > - goto plug; > + if (bio->bi_opf & REQ_NOWAIT) { > + bio->bi_opf &= ~REQ_NOWAIT; > + if (!(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED)) > + goto plug; See below. > + goto add_to_bio_list; > + } > > /* If the zone is already plugged, add the BIO to the plug BIO list. */ > if (zwplug->flags & BLK_ZONE_WPLUG_PLUGGED) > - goto plug; > + goto add_to_bio_list; > > if (!blk_zone_wplug_prepare_bio(zwplug, bio)) { > spin_unlock_irqrestore(&zwplug->lock, flags); > @@ -1060,7 +1048,13 @@ static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs) > return false; > > plug: > + zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; > + schedule_bio_work = true; Since there is only a single "goto plug", I would simply move the 2 lines above together with the goto plug and replace that goto with goto add_to_bio_list. > + > +add_to_bio_list: > 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