Commit a5b97526 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: bypass blkg_tryget_closest for the root_blkg

The root_blkg is only torn down at the very end of removing a queue.
So in the I/O submission path is always has a life reference and we
can just grab another one using blkg_get instead of doing a tryget
and parent walk that won't lead anywhere.
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8c546287
...@@ -1758,16 +1758,21 @@ void bio_associate_blkg_from_css(struct bio *bio, ...@@ -1758,16 +1758,21 @@ void bio_associate_blkg_from_css(struct bio *bio,
struct cgroup_subsys_state *css) struct cgroup_subsys_state *css)
{ {
struct request_queue *q = bio->bi_disk->queue; struct request_queue *q = bio->bi_disk->queue;
struct blkcg_gq *blkg = q->root_blkg;
if (bio->bi_blkg) if (bio->bi_blkg)
blkg_put(bio->bi_blkg); blkg_put(bio->bi_blkg);
rcu_read_lock(); if (css && css->parent) {
if (css && css->parent) struct blkcg_gq *blkg;
rcu_read_lock();
blkg = blkg_lookup_create(css_to_blkcg(css), q); blkg = blkg_lookup_create(css_to_blkcg(css), q);
bio->bi_blkg = blkg_tryget_closest(blkg); bio->bi_blkg = blkg_tryget_closest(blkg);
rcu_read_unlock(); rcu_read_unlock();
} else {
blkg_get(q->root_blkg);
bio->bi_blkg = q->root_blkg;
}
} }
EXPORT_SYMBOL_GPL(bio_associate_blkg_from_css); EXPORT_SYMBOL_GPL(bio_associate_blkg_from_css);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment