Skip to content

Commit 9a9c261

Browse files
Christoph Hellwigaxboe
authored andcommitted
Revert "blk-cgroup: pass a gendisk to blkg_lookup"
This reverts commit 821e840c08ad83736eced4037cdad864e95e2584. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent b6553be commit 9a9c261

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

block/blk-cgroup.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg, struct gendisk *disk,
350350

351351
/* link parent */
352352
if (blkcg_parent(blkcg)) {
353-
blkg->parent = blkg_lookup(blkcg_parent(blkcg), disk);
353+
blkg->parent = blkg_lookup(blkcg_parent(blkcg), disk->queue);
354354
if (WARN_ON_ONCE(!blkg->parent)) {
355355
ret = -ENODEV;
356356
goto err_put_css;
@@ -423,12 +423,12 @@ static struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg,
423423

424424
WARN_ON_ONCE(!rcu_read_lock_held());
425425

426-
blkg = blkg_lookup(blkcg, disk);
426+
blkg = blkg_lookup(blkcg, q);
427427
if (blkg)
428428
return blkg;
429429

430430
spin_lock_irqsave(&q->queue_lock, flags);
431-
blkg = blkg_lookup(blkcg, disk);
431+
blkg = blkg_lookup(blkcg, q);
432432
if (blkg) {
433433
if (blkcg != &blkcg_root &&
434434
blkg != rcu_dereference(blkcg->blkg_hint))
@@ -447,7 +447,7 @@ static struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg,
447447
struct blkcg_gq *ret_blkg = q->root_blkg;
448448

449449
while (parent) {
450-
blkg = blkg_lookup(parent, disk);
450+
blkg = blkg_lookup(parent, q);
451451
if (blkg) {
452452
/* remember closest blkg */
453453
ret_blkg = blkg;
@@ -733,7 +733,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
733733
goto fail_unlock;
734734
}
735735

736-
blkg = blkg_lookup(blkcg, disk);
736+
blkg = blkg_lookup(blkcg, q);
737737
if (blkg)
738738
goto success;
739739

@@ -747,7 +747,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
747747
struct blkcg_gq *new_blkg;
748748

749749
parent = blkcg_parent(blkcg);
750-
while (parent && !blkg_lookup(parent, disk)) {
750+
while (parent && !blkg_lookup(parent, q)) {
751751
pos = parent;
752752
parent = blkcg_parent(parent);
753753
}
@@ -777,7 +777,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
777777
goto fail_preloaded;
778778
}
779779

780-
blkg = blkg_lookup(pos, disk);
780+
blkg = blkg_lookup(pos, q);
781781
if (blkg) {
782782
blkg_free(new_blkg);
783783
} else {
@@ -1852,7 +1852,7 @@ void blkcg_maybe_throttle_current(void)
18521852
blkcg = css_to_blkcg(blkcg_css());
18531853
if (!blkcg)
18541854
goto out;
1855-
blkg = blkg_lookup(blkcg, disk);
1855+
blkg = blkg_lookup(blkcg, disk->queue);
18561856
if (!blkg)
18571857
goto out;
18581858
if (!blkg_tryget(blkg))

block/blk-cgroup.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,30 +234,30 @@ static inline bool bio_issue_as_root_blkg(struct bio *bio)
234234
}
235235

236236
/**
237-
* blkg_lookup - lookup blkg for the specified blkcg - disk pair
237+
* blkg_lookup - lookup blkg for the specified blkcg - q pair
238238
* @blkcg: blkcg of interest
239-
* @disk: gendisk of interest
239+
* @q: request_queue of interest
240240
*
241-
* Lookup blkg for the @blkcg - @disk pair.
241+
* Lookup blkg for the @blkcg - @q pair.
242242
243243
* Must be called in a RCU critical section.
244244
*/
245245
static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg,
246-
struct gendisk *disk)
246+
struct request_queue *q)
247247
{
248248
struct blkcg_gq *blkg;
249249

250250
WARN_ON_ONCE(!rcu_read_lock_held());
251251

252252
if (blkcg == &blkcg_root)
253-
return disk->queue->root_blkg;
253+
return q->root_blkg;
254254

255255
blkg = rcu_dereference(blkcg->blkg_hint);
256-
if (blkg && blkg->disk == disk)
256+
if (blkg && blkg->disk->queue == q)
257257
return blkg;
258258

259-
blkg = radix_tree_lookup(&blkcg->blkg_tree, disk->queue->id);
260-
if (blkg && blkg->disk != disk)
259+
blkg = radix_tree_lookup(&blkcg->blkg_tree, q->id);
260+
if (blkg && blkg->disk->queue != q)
261261
blkg = NULL;
262262
return blkg;
263263
}
@@ -357,7 +357,7 @@ static inline void blkg_put(struct blkcg_gq *blkg)
357357
#define blkg_for_each_descendant_pre(d_blkg, pos_css, p_blkg) \
358358
css_for_each_descendant_pre((pos_css), &(p_blkg)->blkcg->css) \
359359
if (((d_blkg) = blkg_lookup(css_to_blkcg(pos_css), \
360-
(p_blkg)->disk)))
360+
(p_blkg)->disk->queue)))
361361

362362
/**
363363
* blkg_for_each_descendant_post - post-order walk of a blkg's descendants
@@ -372,7 +372,7 @@ static inline void blkg_put(struct blkcg_gq *blkg)
372372
#define blkg_for_each_descendant_post(d_blkg, pos_css, p_blkg) \
373373
css_for_each_descendant_post((pos_css), &(p_blkg)->blkcg->css) \
374374
if (((d_blkg) = blkg_lookup(css_to_blkcg(pos_css), \
375-
(p_blkg)->disk)))
375+
(p_blkg)->disk->queue)))
376376

377377
bool __blkcg_punt_bio_submit(struct bio *bio);
378378

0 commit comments

Comments
 (0)