Skip to content

Commit b86d865

Browse files
KAGA-KOKOaxboe
authored andcommitted
blkcg: Make blkg_root_lookup() work for queues in bypass mode
For legacy queues the only call of blkg_root_lookup() happens after bypass mode has been enabled. Since blkg_lookup() returns NULL for queues in bypass mode, modify the blkg_root_lookup() such that it no longer depends on bypass mode. Rename the function into blk_queue_root_blkg() as suggested by Tejun. Suggested-by: Tejun Heo <tj@kernel.org> Fixes: 6bad9b2 ("blkcg: Introduce blkg_root_lookup()") Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 4645187 commit b86d865

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

block/blk-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ static void __blk_release_queue(struct work_struct *work)
813813
blk_exit_queue(q);
814814
}
815815

816-
WARN(blkg_root_lookup(q),
816+
WARN(blk_queue_root_blkg(q),
817817
"request queue %p is being released but it has not yet been removed from the blkcg controller\n",
818818
q);
819819

include/linux/blk-cgroup.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -342,20 +342,14 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg,
342342
}
343343

344344
/**
345-
* blkg_lookup - look up blkg for the specified request queue
345+
* blk_queue_root_blkg - return blkg for the (blkcg_root, @q) pair
346346
* @q: request_queue of interest
347347
*
348348
* Lookup blkg for @q at the root level. See also blkg_lookup().
349349
*/
350-
static inline struct blkcg_gq *blkg_root_lookup(struct request_queue *q)
350+
static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q)
351351
{
352-
struct blkcg_gq *blkg;
353-
354-
rcu_read_lock();
355-
blkg = blkg_lookup(&blkcg_root, q);
356-
rcu_read_unlock();
357-
358-
return blkg;
352+
return q->root_blkg;
359353
}
360354

361355
/**
@@ -881,7 +875,8 @@ static inline bool blk_cgroup_congested(void) { return false; }
881875
static inline void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay) { }
882876

883877
static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; }
884-
static inline struct blkcg_gq *blkg_root_lookup(struct request_queue *q) { return NULL; }
878+
static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q)
879+
{ return NULL; }
885880
static inline int blkcg_init_queue(struct request_queue *q) { return 0; }
886881
static inline void blkcg_drain_queue(struct request_queue *q) { }
887882
static inline void blkcg_exit_queue(struct request_queue *q) { }

0 commit comments

Comments
 (0)