Skip to content

Commit f9fcc2d

Browse files
htejunaxboe
authored andcommitted
blkcg: collapse blkcg_policy_ops into blkcg_policy
There's no reason to keep blkcg_policy_ops separate. Collapse it into blkcg_policy. This patch doesn't introduce any functional change. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent f95a04a commit f9fcc2d

4 files changed

Lines changed: 24 additions & 28 deletions

File tree

‎block/blk-cgroup.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ static void blkg_free(struct blkcg_gq *blkg)
7878
if (!pd)
7979
continue;
8080

81-
if (pol && pol->ops.pd_exit_fn)
82-
pol->ops.pd_exit_fn(blkg);
81+
if (pol && pol->pd_exit_fn)
82+
pol->pd_exit_fn(blkg);
8383

8484
kfree(pd);
8585
}
@@ -132,7 +132,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q)
132132
struct blkcg_policy *pol = blkcg_policy[i];
133133

134134
if (blkcg_policy_enabled(blkg->q, pol))
135-
pol->ops.pd_init_fn(blkg);
135+
pol->pd_init_fn(blkg);
136136
}
137137

138138
return blkg;
@@ -305,8 +305,8 @@ static int blkcg_reset_stats(struct cgroup *cgroup, struct cftype *cftype,
305305
struct blkcg_policy *pol = blkcg_policy[i];
306306

307307
if (blkcg_policy_enabled(blkg->q, pol) &&
308-
pol->ops.pd_reset_stats_fn)
309-
pol->ops.pd_reset_stats_fn(blkg);
308+
pol->pd_reset_stats_fn)
309+
pol->pd_reset_stats_fn(blkg);
310310
}
311311
}
312312

@@ -758,7 +758,7 @@ int blkcg_activate_policy(struct request_queue *q,
758758

759759
blkg->pd[pol->plid] = pd;
760760
pd->blkg = blkg;
761-
pol->ops.pd_init_fn(blkg);
761+
pol->pd_init_fn(blkg);
762762

763763
spin_unlock(&blkg->blkcg->lock);
764764
}
@@ -804,8 +804,8 @@ void blkcg_deactivate_policy(struct request_queue *q,
804804
/* grab blkcg lock too while removing @pd from @blkg */
805805
spin_lock(&blkg->blkcg->lock);
806806

807-
if (pol->ops.pd_exit_fn)
808-
pol->ops.pd_exit_fn(blkg);
807+
if (pol->pd_exit_fn)
808+
pol->pd_exit_fn(blkg);
809809

810810
kfree(blkg->pd[pol->plid]);
811811
blkg->pd[pol->plid] = NULL;

‎block/blk-cgroup.h‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,17 @@ typedef void (blkcg_pol_init_pd_fn)(struct blkcg_gq *blkg);
9999
typedef void (blkcg_pol_exit_pd_fn)(struct blkcg_gq *blkg);
100100
typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkcg_gq *blkg);
101101

102-
struct blkcg_policy_ops {
103-
blkcg_pol_init_pd_fn *pd_init_fn;
104-
blkcg_pol_exit_pd_fn *pd_exit_fn;
105-
blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn;
106-
};
107-
108102
struct blkcg_policy {
109-
struct blkcg_policy_ops ops;
110103
int plid;
111104
/* policy specific private data size */
112105
size_t pd_size;
113106
/* cgroup files for the policy */
114107
struct cftype *cftypes;
108+
109+
/* operations */
110+
blkcg_pol_init_pd_fn *pd_init_fn;
111+
blkcg_pol_exit_pd_fn *pd_exit_fn;
112+
blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn;
115113
};
116114

117115
extern struct blkcg blkcg_root;

‎block/blk-throttle.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,13 +1100,12 @@ static void throtl_shutdown_wq(struct request_queue *q)
11001100
}
11011101

11021102
static struct blkcg_policy blkcg_policy_throtl = {
1103-
.ops = {
1104-
.pd_init_fn = throtl_pd_init,
1105-
.pd_exit_fn = throtl_pd_exit,
1106-
.pd_reset_stats_fn = throtl_pd_reset_stats,
1107-
},
1108-
.pd_size = sizeof(struct throtl_grp),
1109-
.cftypes = throtl_files,
1103+
.pd_size = sizeof(struct throtl_grp),
1104+
.cftypes = throtl_files,
1105+
1106+
.pd_init_fn = throtl_pd_init,
1107+
.pd_exit_fn = throtl_pd_exit,
1108+
.pd_reset_stats_fn = throtl_pd_reset_stats,
11101109
};
11111110

11121111
bool blk_throtl_bio(struct request_queue *q, struct bio *bio)

‎block/cfq-iosched.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,12 +4165,11 @@ static struct elevator_type iosched_cfq = {
41654165

41664166
#ifdef CONFIG_CFQ_GROUP_IOSCHED
41674167
static struct blkcg_policy blkcg_policy_cfq = {
4168-
.ops = {
4169-
.pd_init_fn = cfq_pd_init,
4170-
.pd_reset_stats_fn = cfq_pd_reset_stats,
4171-
},
4172-
.pd_size = sizeof(struct cfq_group),
4173-
.cftypes = cfq_blkcg_files,
4168+
.pd_size = sizeof(struct cfq_group),
4169+
.cftypes = cfq_blkcg_files,
4170+
4171+
.pd_init_fn = cfq_pd_init,
4172+
.pd_reset_stats_fn = cfq_pd_reset_stats,
41744173
};
41754174
#endif
41764175

0 commit comments

Comments
 (0)