Skip to content

Commit ff93ea0

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: shortcut __submit_bio_noacct for blk-mq drivers
For blk-mq drivers bios can only be inserted for the same queue. So bypass the complicated sorting logic in __submit_bio_noacct with a blk-mq simpler submission helper. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 566acf2 commit ff93ea0

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

block/blk-core.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,34 @@ static blk_qc_t __submit_bio_noacct(struct bio *bio)
11521152
return ret;
11531153
}
11541154

1155+
static blk_qc_t __submit_bio_noacct_mq(struct bio *bio)
1156+
{
1157+
struct gendisk *disk = bio->bi_disk;
1158+
struct bio_list bio_list;
1159+
blk_qc_t ret = BLK_QC_T_NONE;
1160+
1161+
bio_list_init(&bio_list);
1162+
current->bio_list = &bio_list;
1163+
1164+
do {
1165+
WARN_ON_ONCE(bio->bi_disk != disk);
1166+
1167+
if (unlikely(bio_queue_enter(bio) != 0))
1168+
continue;
1169+
1170+
if (!blk_crypto_bio_prep(&bio)) {
1171+
blk_queue_exit(disk->queue);
1172+
ret = BLK_QC_T_NONE;
1173+
continue;
1174+
}
1175+
1176+
ret = blk_mq_submit_bio(bio);
1177+
} while ((bio = bio_list_pop(&bio_list)));
1178+
1179+
current->bio_list = NULL;
1180+
return ret;
1181+
}
1182+
11551183
/**
11561184
* submit_bio_noacct - re-submit a bio to the block device layer for I/O
11571185
* @bio: The bio describing the location in memory and on the device.
@@ -1177,6 +1205,8 @@ blk_qc_t submit_bio_noacct(struct bio *bio)
11771205
return BLK_QC_T_NONE;
11781206
}
11791207

1208+
if (!bio->bi_disk->fops->submit_bio)
1209+
return __submit_bio_noacct_mq(bio);
11801210
return __submit_bio_noacct(bio);
11811211
}
11821212
EXPORT_SYMBOL(submit_bio_noacct);

0 commit comments

Comments
 (0)