Skip to content

Commit 79c6c60

Browse files
YuKuai-huaweiaxboe
authored andcommitted
blk-ioprio: remove per-disk structure
ioprio works on the blk-cgroup level, all disks in the same cgroup are the same, and the struct ioprio_blkg doesn't have anything in it. Hence register the policy is enough, because cpd_alloc/free_fn will be handled for each blk-cgroup, and there is no need to activate the policy for disk. Hence remove blk_ioprio_init/exit and ioprio_alloc/free_pd. Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Acked-by: Tejun Heo <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent d0e9279 commit 79c6c60

File tree

3 files changed

+0
-62
lines changed

3 files changed

+0
-62
lines changed

block/blk-cgroup.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,6 @@ int blkcg_init_disk(struct gendisk *disk)
14581458
struct request_queue *q = disk->queue;
14591459
struct blkcg_gq *new_blkg, *blkg;
14601460
bool preloaded;
1461-
int ret;
14621461

14631462
new_blkg = blkg_alloc(&blkcg_root, disk, GFP_KERNEL);
14641463
if (!new_blkg)
@@ -1478,15 +1477,8 @@ int blkcg_init_disk(struct gendisk *disk)
14781477
if (preloaded)
14791478
radix_tree_preload_end();
14801479

1481-
ret = blk_ioprio_init(disk);
1482-
if (ret)
1483-
goto err_destroy_all;
1484-
14851480
return 0;
14861481

1487-
err_destroy_all:
1488-
blkg_destroy_all(disk);
1489-
return ret;
14901482
err_unlock:
14911483
spin_unlock_irq(&q->queue_lock);
14921484
if (preloaded)

block/blk-ioprio.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ static const char *policy_name[] = {
4949

5050
static struct blkcg_policy ioprio_policy;
5151

52-
/**
53-
* struct ioprio_blkg - Per (cgroup, request queue) data.
54-
* @pd: blkg_policy_data structure.
55-
*/
56-
struct ioprio_blkg {
57-
struct blkg_policy_data pd;
58-
};
59-
6052
/**
6153
* struct ioprio_blkcg - Per cgroup data.
6254
* @cpd: blkcg_policy_data structure.
@@ -67,11 +59,6 @@ struct ioprio_blkcg {
6759
enum prio_policy prio_policy;
6860
};
6961

70-
static inline struct ioprio_blkg *pd_to_ioprio(struct blkg_policy_data *pd)
71-
{
72-
return pd ? container_of(pd, struct ioprio_blkg, pd) : NULL;
73-
}
74-
7562
static struct ioprio_blkcg *blkcg_to_ioprio_blkcg(struct blkcg *blkcg)
7663
{
7764
return container_of(blkcg_to_cpd(blkcg, &ioprio_policy),
@@ -108,25 +95,6 @@ static ssize_t ioprio_set_prio_policy(struct kernfs_open_file *of, char *buf,
10895
return nbytes;
10996
}
11097

111-
static struct blkg_policy_data *
112-
ioprio_alloc_pd(struct gendisk *disk, struct blkcg *blkcg, gfp_t gfp)
113-
{
114-
struct ioprio_blkg *ioprio_blkg;
115-
116-
ioprio_blkg = kzalloc(sizeof(*ioprio_blkg), gfp);
117-
if (!ioprio_blkg)
118-
return NULL;
119-
120-
return &ioprio_blkg->pd;
121-
}
122-
123-
static void ioprio_free_pd(struct blkg_policy_data *pd)
124-
{
125-
struct ioprio_blkg *ioprio_blkg = pd_to_ioprio(pd);
126-
127-
kfree(ioprio_blkg);
128-
}
129-
13098
static struct blkcg_policy_data *ioprio_alloc_cpd(gfp_t gfp)
13199
{
132100
struct ioprio_blkcg *blkcg;
@@ -169,9 +137,6 @@ static struct blkcg_policy ioprio_policy = {
169137

170138
.cpd_alloc_fn = ioprio_alloc_cpd,
171139
.cpd_free_fn = ioprio_free_cpd,
172-
173-
.pd_alloc_fn = ioprio_alloc_pd,
174-
.pd_free_fn = ioprio_free_pd,
175140
};
176141

177142
void blkcg_set_ioprio(struct bio *bio)
@@ -209,16 +174,6 @@ void blkcg_set_ioprio(struct bio *bio)
209174
bio->bi_ioprio = prio;
210175
}
211176

212-
void blk_ioprio_exit(struct gendisk *disk)
213-
{
214-
blkcg_deactivate_policy(disk, &ioprio_policy);
215-
}
216-
217-
int blk_ioprio_init(struct gendisk *disk)
218-
{
219-
return blkcg_activate_policy(disk, &ioprio_policy);
220-
}
221-
222177
static int __init ioprio_init(void)
223178
{
224179
return blkcg_policy_register(&ioprio_policy);

block/blk-ioprio.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,8 @@ struct request_queue;
99
struct bio;
1010

1111
#ifdef CONFIG_BLK_CGROUP_IOPRIO
12-
int blk_ioprio_init(struct gendisk *disk);
13-
void blk_ioprio_exit(struct gendisk *disk);
1412
void blkcg_set_ioprio(struct bio *bio);
1513
#else
16-
static inline int blk_ioprio_init(struct gendisk *disk)
17-
{
18-
return 0;
19-
}
20-
static inline void blk_ioprio_exit(struct gendisk *disk)
21-
{
22-
}
2314
static inline void blkcg_set_ioprio(struct bio *bio)
2415
{
2516
}

0 commit comments

Comments
 (0)