diff options
author | Jinke Han <hanjinke.666@bytedance.com> | 2023-02-16 06:22:50 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-02-16 21:04:11 +0300 |
commit | 0f7c8f0f7934c389b0f9fa1f151e753d8de6348f (patch) | |
tree | 415fc7e99044292219d38b7181379204081d20c2 /block | |
parent | 67205f80be9910207481406c47f7d85e703fb2e9 (diff) | |
download | linux-0f7c8f0f7934c389b0f9fa1f151e753d8de6348f.tar.xz |
block: Fix io statistics for cgroup in throttle path
In the current code, io statistics are missing for cgroup when bio
was throttled by blk-throttle. Fix it by moving the unreaching code
to submit_bio_noacct_nocheck.
Fixes: 3f98c753717c ("block: don't check bio in blk_throtl_dispatch_work_fn")
Signed-off-by: Jinke Han <hanjinke.666@bytedance.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Acked-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230216032250.74230-1-hanjinke.666@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index ccf9a7683a3c..5fb6856745b4 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -684,6 +684,18 @@ static void __submit_bio_noacct_mq(struct bio *bio) void submit_bio_noacct_nocheck(struct bio *bio) { + blk_cgroup_bio_start(bio); + blkcg_bio_issue_init(bio); + + if (!bio_flagged(bio, BIO_TRACE_COMPLETION)) { + trace_block_bio_queue(bio); + /* + * Now that enqueuing has been traced, we need to trace + * completion as well. + */ + bio_set_flag(bio, BIO_TRACE_COMPLETION); + } + /* * We only want one ->submit_bio to be active at a time, else stack * usage with stacked devices could be a problem. Use current->bio_list @@ -788,17 +800,6 @@ void submit_bio_noacct(struct bio *bio) if (blk_throtl_bio(bio)) return; - - blk_cgroup_bio_start(bio); - blkcg_bio_issue_init(bio); - - if (!bio_flagged(bio, BIO_TRACE_COMPLETION)) { - trace_block_bio_queue(bio); - /* Now that enqueuing has been traced, we need to trace - * completion as well. - */ - bio_set_flag(bio, BIO_TRACE_COMPLETION); - } submit_bio_noacct_nocheck(bio); return; |