Skip to content

Commit 060406c

Browse files
YuKuai-huaweiaxboe
authored andcommitted
block: add plug while submitting IO
So that if caller didn't use plug, for example, __blkdev_direct_IO_simple() and __blkdev_direct_IO_async(), block layer can still benefit from caching nsec time in the plug. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20240509123825.3225207-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 3a86156 commit 060406c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

block/blk-core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,11 +646,13 @@ static void __submit_bio(struct bio *bio)
646646
static void __submit_bio_noacct(struct bio *bio)
647647
{
648648
struct bio_list bio_list_on_stack[2];
649+
struct blk_plug plug;
649650

650651
BUG_ON(bio->bi_next);
651652

652653
bio_list_init(&bio_list_on_stack[0]);
653654
current->bio_list = bio_list_on_stack;
655+
blk_start_plug(&plug);
654656

655657
do {
656658
struct request_queue *q = bdev_get_queue(bio->bi_bdev);
@@ -684,19 +686,23 @@ static void __submit_bio_noacct(struct bio *bio)
684686
bio_list_merge(&bio_list_on_stack[0], &bio_list_on_stack[1]);
685687
} while ((bio = bio_list_pop(&bio_list_on_stack[0])));
686688

689+
blk_finish_plug(&plug);
687690
current->bio_list = NULL;
688691
}
689692

690693
static void __submit_bio_noacct_mq(struct bio *bio)
691694
{
692695
struct bio_list bio_list[2] = { };
696+
struct blk_plug plug;
693697

694698
current->bio_list = bio_list;
699+
blk_start_plug(&plug);
695700

696701
do {
697702
__submit_bio(bio);
698703
} while ((bio = bio_list_pop(&bio_list[0])));
699704

705+
blk_finish_plug(&plug);
700706
current->bio_list = NULL;
701707
}
702708

0 commit comments

Comments
 (0)