diff options
author | Yu Kuai <yukuai3@huawei.com> | 2024-05-09 14:38:25 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-05-09 15:57:37 +0200 |
commit | 060406c61c7cb4bbd82a02d179decca9c9bb3443 (patch) | |
tree | b61bd7831d1740ac42c26dc78c38b3bc28772dea /block/blk-core.c | |
parent | bcache: fix variable length array abuse in btree_iter (diff) | |
download | linux-060406c61c7cb4bbd82a02d179decca9c9bb3443.tar.xz linux-060406c61c7cb4bbd82a02d179decca9c9bb3443.zip |
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>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r-- | block/blk-core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 47400a4fe851..8efee8faa4b6 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -646,11 +646,13 @@ static void __submit_bio(struct bio *bio) static void __submit_bio_noacct(struct bio *bio) { struct bio_list bio_list_on_stack[2]; + struct blk_plug plug; BUG_ON(bio->bi_next); bio_list_init(&bio_list_on_stack[0]); current->bio_list = bio_list_on_stack; + blk_start_plug(&plug); do { struct request_queue *q = bdev_get_queue(bio->bi_bdev); @@ -684,19 +686,23 @@ static void __submit_bio_noacct(struct bio *bio) bio_list_merge(&bio_list_on_stack[0], &bio_list_on_stack[1]); } while ((bio = bio_list_pop(&bio_list_on_stack[0]))); + blk_finish_plug(&plug); current->bio_list = NULL; } static void __submit_bio_noacct_mq(struct bio *bio) { struct bio_list bio_list[2] = { }; + struct blk_plug plug; current->bio_list = bio_list; + blk_start_plug(&plug); do { __submit_bio(bio); } while ((bio = bio_list_pop(&bio_list[0]))); + blk_finish_plug(&plug); current->bio_list = NULL; } |