Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller

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. Additionally, the 'schedule_bio_work'
variable is removed. 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 <dlmoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Bart Van Assche and committed by
Jens Axboe
f2333391 faa3be1a

+17 -25
+17 -25
block/blk-zoned.c
··· 1204 1204 struct blk_zone_wplug *zwplug, 1205 1205 struct bio *bio, unsigned int nr_segs) 1206 1206 { 1207 - bool schedule_bio_work = false; 1208 - 1209 1207 /* 1210 1208 * Grab an extra reference on the BIO request queue usage counter. 1211 1209 * This reference will be reused to submit a request for the BIO for ··· 1220 1222 bio_clear_polled(bio); 1221 1223 1222 1224 /* 1223 - * REQ_NOWAIT BIOs are always handled using the zone write plug BIO 1224 - * work, which can block. So clear the REQ_NOWAIT flag and schedule the 1225 - * work if this is the first BIO we are plugging. 1226 - */ 1227 - if (bio->bi_opf & REQ_NOWAIT) { 1228 - schedule_bio_work = !(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED); 1229 - bio->bi_opf &= ~REQ_NOWAIT; 1230 - } 1231 - 1232 - /* 1233 1225 * Reuse the poll cookie field to store the number of segments when 1234 1226 * split to the hardware limits. 1235 1227 */ ··· 1234 1246 bio_list_add(&zwplug->bio_list, bio); 1235 1247 trace_disk_zone_wplug_add_bio(zwplug->disk->queue, zwplug->zone_no, 1236 1248 bio->bi_iter.bi_sector, bio_sectors(bio)); 1237 - 1238 - zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; 1239 - 1240 - if (schedule_bio_work) 1241 - disk_zone_wplug_schedule_bio_work(disk, zwplug); 1242 1249 } 1243 1250 1244 1251 /* ··· 1444 1461 bio_set_flag(bio, BIO_ZONE_WRITE_PLUGGING); 1445 1462 1446 1463 /* 1447 - * If the zone is already plugged, add the BIO to the plug BIO list. 1448 - * Do the same for REQ_NOWAIT BIOs to ensure that we will not see a 1449 - * BLK_STS_AGAIN failure if we let the BIO execute. 1450 - * Otherwise, plug and let the BIO execute. 1464 + * Add REQ_NOWAIT BIOs to the plug list to ensure that we will not see a 1465 + * BLK_STS_AGAIN failure if we let the caller submit the BIO. 1451 1466 */ 1452 - if ((zwplug->flags & BLK_ZONE_WPLUG_PLUGGED) || 1453 - (bio->bi_opf & REQ_NOWAIT)) 1454 - goto plug; 1467 + if (bio->bi_opf & REQ_NOWAIT) { 1468 + bio->bi_opf &= ~REQ_NOWAIT; 1469 + goto queue_bio; 1470 + } 1471 + 1472 + /* If the zone is already plugged, add the BIO to the BIO plug list. */ 1473 + if (zwplug->flags & BLK_ZONE_WPLUG_PLUGGED) 1474 + goto queue_bio; 1455 1475 1456 1476 if (!blk_zone_wplug_prepare_bio(zwplug, bio)) { 1457 1477 spin_unlock_irqrestore(&zwplug->lock, flags); ··· 1462 1476 return true; 1463 1477 } 1464 1478 1479 + /* Otherwise, plug and let the caller submit the BIO. */ 1465 1480 zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; 1466 1481 1467 1482 spin_unlock_irqrestore(&zwplug->lock, flags); 1468 1483 1469 1484 return false; 1470 1485 1471 - plug: 1486 + queue_bio: 1472 1487 disk_zone_wplug_add_bio(disk, zwplug, bio, nr_segs); 1488 + 1489 + if (!(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED)) { 1490 + zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; 1491 + disk_zone_wplug_schedule_bio_work(disk, zwplug); 1492 + } 1473 1493 1474 1494 spin_unlock_irqrestore(&zwplug->lock, flags); 1475 1495