Skip to content

Commit 0f7c8f0

Browse files
Jinke Hanaxboe
authored andcommitted
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: 3f98c75 ("block: don't check bio in blk_throtl_dispatch_work_fn") Signed-off-by: Jinke Han <[email protected]> Reviewed-by: Ming Lei <[email protected]> Acked-by: Muchun Song <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 67205f8 commit 0f7c8f0

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

block/blk-core.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,18 @@ static void __submit_bio_noacct_mq(struct bio *bio)
684684

685685
void submit_bio_noacct_nocheck(struct bio *bio)
686686
{
687+
blk_cgroup_bio_start(bio);
688+
blkcg_bio_issue_init(bio);
689+
690+
if (!bio_flagged(bio, BIO_TRACE_COMPLETION)) {
691+
trace_block_bio_queue(bio);
692+
/*
693+
* Now that enqueuing has been traced, we need to trace
694+
* completion as well.
695+
*/
696+
bio_set_flag(bio, BIO_TRACE_COMPLETION);
697+
}
698+
687699
/*
688700
* We only want one ->submit_bio to be active at a time, else stack
689701
* usage with stacked devices could be a problem. Use current->bio_list
@@ -788,17 +800,6 @@ void submit_bio_noacct(struct bio *bio)
788800

789801
if (blk_throtl_bio(bio))
790802
return;
791-
792-
blk_cgroup_bio_start(bio);
793-
blkcg_bio_issue_init(bio);
794-
795-
if (!bio_flagged(bio, BIO_TRACE_COMPLETION)) {
796-
trace_block_bio_queue(bio);
797-
/* Now that enqueuing has been traced, we need to trace
798-
* completion as well.
799-
*/
800-
bio_set_flag(bio, BIO_TRACE_COMPLETION);
801-
}
802803
submit_bio_noacct_nocheck(bio);
803804
return;
804805

0 commit comments

Comments
 (0)