block: move the bio cgroup associatation helpers to blk-cgroup.c

Keep the cgroup code together.

Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2020-06-27 09:31:51 +02:00 committed by Jens Axboe
parent a18b9b1590
commit 28fc591ff9
3 changed files with 101 additions and 107 deletions

View file

@ -183,10 +183,6 @@ extern bool blkcg_debug_stats;
struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg,
struct request_queue *q, bool update_hint);
struct blkcg_gq *__blkg_lookup_create(struct blkcg *blkcg,
struct request_queue *q);
struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg,
struct request_queue *q);
int blkcg_init_queue(struct request_queue *q);
void blkcg_exit_queue(struct request_queue *q);
@ -480,32 +476,6 @@ static inline bool blkg_tryget(struct blkcg_gq *blkg)
return blkg && percpu_ref_tryget(&blkg->refcnt);
}
/**
* blkg_tryget_closest - try and get a blkg ref on the closet blkg
* @blkg: blkg to get
*
* This needs to be called rcu protected. As the failure mode here is to walk
* up the blkg tree, this ensure that the blkg->parent pointers are always
* valid. This returns the blkg that it ended up taking a reference on or %NULL
* if no reference was taken.
*/
static inline struct blkcg_gq *blkg_tryget_closest(struct blkcg_gq *blkg)
{
struct blkcg_gq *ret_blkg = NULL;
WARN_ON_ONCE(!rcu_read_lock_held());
while (blkg) {
if (blkg_tryget(blkg)) {
ret_blkg = blkg;
break;
}
blkg = blkg->parent;
}
return ret_blkg;
}
/**
* blkg_put - put a blkg reference
* @blkg: blkg to put