Skip to content

Commit 650e2cb

Browse files
Chengming Zhouaxboe
authored andcommitted
blk-cgroup: delete cpd_init_fn of blkcg_policy
blkcg_policy cpd_init_fn() is used to just initialize some default fields of policy data, which is enough to do in cpd_alloc_fn(). This patch delete the only user bfq_cpd_init(), and remove cpd_init_fn from blkcg_policy. Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> Acked-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/20230406145050.49914-4-zhouchengming@bytedance.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent d102316 commit 650e2cb

3 files changed

Lines changed: 2 additions & 13 deletions

File tree

block/bfq-cgroup.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,14 +497,9 @@ static struct blkcg_policy_data *bfq_cpd_alloc(gfp_t gfp)
497497
bgd = kzalloc(sizeof(*bgd), gfp);
498498
if (!bgd)
499499
return NULL;
500-
return &bgd->pd;
501-
}
502500

503-
static void bfq_cpd_init(struct blkcg_policy_data *cpd)
504-
{
505-
struct bfq_group_data *d = cpd_to_bfqgd(cpd);
506-
507-
d->weight = CGROUP_WEIGHT_DFL;
501+
bgd->weight = CGROUP_WEIGHT_DFL;
502+
return &bgd->pd;
508503
}
509504

510505
static void bfq_cpd_free(struct blkcg_policy_data *cpd)
@@ -1300,7 +1295,6 @@ struct blkcg_policy blkcg_policy_bfq = {
13001295
.legacy_cftypes = bfq_blkcg_legacy_files,
13011296

13021297
.cpd_alloc_fn = bfq_cpd_alloc,
1303-
.cpd_init_fn = bfq_cpd_init,
13041298
.cpd_free_fn = bfq_cpd_free,
13051299

13061300
.pd_alloc_fn = bfq_pd_alloc,

block/blk-cgroup.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,6 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css)
12491249
blkcg->cpd[i] = cpd;
12501250
cpd->blkcg = blkcg;
12511251
cpd->plid = i;
1252-
if (pol->cpd_init_fn)
1253-
pol->cpd_init_fn(cpd);
12541252
}
12551253

12561254
spin_lock_init(&blkcg->lock);
@@ -1605,8 +1603,6 @@ int blkcg_policy_register(struct blkcg_policy *pol)
16051603
blkcg->cpd[pol->plid] = cpd;
16061604
cpd->blkcg = blkcg;
16071605
cpd->plid = pol->plid;
1608-
if (pol->cpd_init_fn)
1609-
pol->cpd_init_fn(cpd);
16101606
}
16111607
}
16121608

block/blk-cgroup.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ struct blkcg_policy {
173173

174174
/* operations */
175175
blkcg_pol_alloc_cpd_fn *cpd_alloc_fn;
176-
blkcg_pol_init_cpd_fn *cpd_init_fn;
177176
blkcg_pol_free_cpd_fn *cpd_free_fn;
178177

179178
blkcg_pol_alloc_pd_fn *pd_alloc_fn;

0 commit comments

Comments
 (0)