summaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-02-03 16:03:47 +0100
committerJens Axboe <axboe@kernel.dk>2023-02-03 08:20:05 -0700
commit84d7d462b16dd5f0bf7c7ca9254bf81db2c952a2 (patch)
tree338edb3db9c6078f07403110e27b65c471818750 /block/blk-cgroup.h
parent180b04d450a7137270c12dbb6bebf1d5e6c0a6f2 (diff)
downloadlinux-84d7d462b16dd5f0bf7c7ca9254bf81db2c952a2.tar.gz
linux-84d7d462b16dd5f0bf7c7ca9254bf81db2c952a2.tar.bz2
linux-84d7d462b16dd5f0bf7c7ca9254bf81db2c952a2.zip
blk-cgroup: pin the gendisk in struct blkcg_gq
Currently each blkcg_gq holds a request_queue reference, which is what is used in the policies. But a lot of these interfaces will move over to use a gendisk, so store a disk in struct blkcg_gq and hold a reference to it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andreas Herrmann <aherrmann@suse.de> Acked-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/20230203150400.3199230-7-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index b13ee84f358e..996572a9a0b7 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -53,8 +53,7 @@ struct blkg_iostat_set {
/* association between a blk cgroup and a request queue */
struct blkcg_gq {
- /* Pointer to the associated request_queue */
- struct request_queue *q;
+ struct gendisk *disk;
struct list_head q_node;
struct hlist_node blkcg_node;
struct blkcg *blkcg;
@@ -255,11 +254,11 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg,
return q->root_blkg;
blkg = rcu_dereference(blkcg->blkg_hint);
- if (blkg && blkg->q == q)
+ if (blkg && blkg->disk->queue == q)
return blkg;
blkg = radix_tree_lookup(&blkcg->blkg_tree, q->id);
- if (blkg && blkg->q != q)
+ if (blkg && blkg->disk->queue != q)
blkg = NULL;
return blkg;
}
@@ -359,7 +358,7 @@ static inline void blkg_put(struct blkcg_gq *blkg)
#define blkg_for_each_descendant_pre(d_blkg, pos_css, p_blkg) \
css_for_each_descendant_pre((pos_css), &(p_blkg)->blkcg->css) \
if (((d_blkg) = blkg_lookup(css_to_blkcg(pos_css), \
- (p_blkg)->q)))
+ (p_blkg)->disk->queue)))
/**
* blkg_for_each_descendant_post - post-order walk of a blkg's descendants
@@ -374,7 +373,7 @@ static inline void blkg_put(struct blkcg_gq *blkg)
#define blkg_for_each_descendant_post(d_blkg, pos_css, p_blkg) \
css_for_each_descendant_post((pos_css), &(p_blkg)->blkcg->css) \
if (((d_blkg) = blkg_lookup(css_to_blkcg(pos_css), \
- (p_blkg)->q)))
+ (p_blkg)->disk->queue)))
bool __blkcg_punt_bio_submit(struct bio *bio);