Skip to content

Commit

Permalink
block: make blk-throttle preserve the issuing task on delayed bios
Browse files Browse the repository at this point in the history
Make blk-throttle call bio_associate_current() on bios being delayed
such that they get issued to block layer with the original io_context.
This allows stacking blk-throttle and cfq-iosched propio policies.
bios will always be issued with the correct ioc and blkcg whether it
gets delayed by blk-throttle or not.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Mar 6, 2012
1 parent 4f85cb9 commit 671058f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,9 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
goto out;
}

/* bio_associate_current() needs ioc, try creating */
create_io_context(GFP_ATOMIC, q->node);

/*
* A throtl_grp pointer retrieved under rcu can be used to access
* basic fields like stats and io rates. If a group has no rules,
Expand Down Expand Up @@ -958,6 +961,7 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
tg->io_disp[rw], tg->iops[rw],
tg->nr_queued[READ], tg->nr_queued[WRITE]);

bio_associate_current(bio);
throtl_add_bio_tg(q->td, tg, bio);
throttled = true;

Expand Down

0 comments on commit 671058f

Please sign in to comment.