Skip to content

Commit a36647d

Browse files
bvanasschekawasaki
authored andcommitted
blk-zoned: Introduce a loop in blk_zone_wplug_bio_work()
Prepare for submitting multiple bios from inside a single blk_zone_wplug_bio_work() call. No functionality has been changed. Cc: Damien Le Moal <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Bart Van Assche <[email protected]>
1 parent 938e344 commit a36647d

1 file changed

Lines changed: 35 additions & 31 deletions

File tree

block/blk-zoned.c

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,44 +1283,48 @@ static void blk_zone_wplug_bio_work(struct work_struct *work)
12831283
unsigned long flags;
12841284
struct bio *bio;
12851285

1286-
/*
1287-
* Submit the next plugged BIO. If we do not have any, clear
1288-
* the plugged flag.
1289-
*/
1290-
spin_lock_irqsave(&zwplug->lock, flags);
1286+
do {
1287+
/*
1288+
* Submit the next plugged BIO. If we do not have any, clear
1289+
* the plugged flag.
1290+
*/
1291+
spin_lock_irqsave(&zwplug->lock, flags);
12911292

12921293
again:
1293-
bio = bio_list_pop(&zwplug->bio_list);
1294-
if (!bio) {
1295-
zwplug->flags &= ~BLK_ZONE_WPLUG_PLUGGED;
1296-
spin_unlock_irqrestore(&zwplug->lock, flags);
1297-
goto put_zwplug;
1298-
}
1294+
bio = bio_list_pop(&zwplug->bio_list);
1295+
if (!bio) {
1296+
zwplug->flags &= ~BLK_ZONE_WPLUG_PLUGGED;
1297+
spin_unlock_irqrestore(&zwplug->lock, flags);
1298+
goto put_zwplug;
1299+
}
12991300

1300-
trace_blk_zone_wplug_bio(zwplug->disk->queue, zwplug->zone_no,
1301-
bio->bi_iter.bi_sector, bio_sectors(bio));
1301+
trace_blk_zone_wplug_bio(zwplug->disk->queue,
1302+
zwplug->zone_no,
1303+
bio->bi_iter.bi_sector,
1304+
bio_sectors(bio));
13021305

1303-
if (!blk_zone_wplug_prepare_bio(zwplug, bio)) {
1304-
blk_zone_wplug_bio_io_error(zwplug, bio);
1305-
goto again;
1306-
}
1306+
if (!blk_zone_wplug_prepare_bio(zwplug, bio)) {
1307+
blk_zone_wplug_bio_io_error(zwplug, bio);
1308+
goto again;
1309+
}
13071310

1308-
spin_unlock_irqrestore(&zwplug->lock, flags);
1311+
spin_unlock_irqrestore(&zwplug->lock, flags);
13091312

1310-
bdev = bio->bi_bdev;
1313+
bdev = bio->bi_bdev;
13111314

1312-
/*
1313-
* blk-mq devices will reuse the extra reference on the request queue
1314-
* usage counter we took when the BIO was plugged, but the submission
1315-
* path for BIO-based devices will not do that. So drop this extra
1316-
* reference here.
1317-
*/
1318-
if (bdev_test_flag(bdev, BD_HAS_SUBMIT_BIO)) {
1319-
bdev->bd_disk->fops->submit_bio(bio);
1320-
blk_queue_exit(bdev->bd_disk->queue);
1321-
} else {
1322-
blk_mq_submit_bio(bio);
1323-
}
1315+
/*
1316+
* blk-mq devices will reuse the extra reference on the request
1317+
* queue usage counter we took when the BIO was plugged, but the
1318+
* submission path for BIO-based devices will not do that. So
1319+
* drop this extra reference here.
1320+
*/
1321+
if (bdev_test_flag(bdev, BD_HAS_SUBMIT_BIO)) {
1322+
bdev->bd_disk->fops->submit_bio(bio);
1323+
blk_queue_exit(bdev->bd_disk->queue);
1324+
} else {
1325+
blk_mq_submit_bio(bio);
1326+
}
1327+
} while (0);
13241328

13251329
put_zwplug:
13261330
/* Drop the reference we took in disk_zone_wplug_schedule_bio_work(). */

0 commit comments

Comments
 (0)