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>
This commit is contained in:
parent
f95a04afa8
commit
f9fcc2d391
|
@ -78,8 +78,8 @@ static void blkg_free(struct blkcg_gq *blkg)
|
||||||
if (!pd)
|
if (!pd)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pol && pol->ops.pd_exit_fn)
|
if (pol && pol->pd_exit_fn)
|
||||||
pol->ops.pd_exit_fn(blkg);
|
pol->pd_exit_fn(blkg);
|
||||||
|
|
||||||
kfree(pd);
|
kfree(pd);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q)
|
||||||
struct blkcg_policy *pol = blkcg_policy[i];
|
struct blkcg_policy *pol = blkcg_policy[i];
|
||||||
|
|
||||||
if (blkcg_policy_enabled(blkg->q, pol))
|
if (blkcg_policy_enabled(blkg->q, pol))
|
||||||
pol->ops.pd_init_fn(blkg);
|
pol->pd_init_fn(blkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return blkg;
|
return blkg;
|
||||||
|
@ -305,8 +305,8 @@ static int blkcg_reset_stats(struct cgroup *cgroup, struct cftype *cftype,
|
||||||
struct blkcg_policy *pol = blkcg_policy[i];
|
struct blkcg_policy *pol = blkcg_policy[i];
|
||||||
|
|
||||||
if (blkcg_policy_enabled(blkg->q, pol) &&
|
if (blkcg_policy_enabled(blkg->q, pol) &&
|
||||||
pol->ops.pd_reset_stats_fn)
|
pol->pd_reset_stats_fn)
|
||||||
pol->ops.pd_reset_stats_fn(blkg);
|
pol->pd_reset_stats_fn(blkg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,7 +758,7 @@ int blkcg_activate_policy(struct request_queue *q,
|
||||||
|
|
||||||
blkg->pd[pol->plid] = pd;
|
blkg->pd[pol->plid] = pd;
|
||||||
pd->blkg = blkg;
|
pd->blkg = blkg;
|
||||||
pol->ops.pd_init_fn(blkg);
|
pol->pd_init_fn(blkg);
|
||||||
|
|
||||||
spin_unlock(&blkg->blkcg->lock);
|
spin_unlock(&blkg->blkcg->lock);
|
||||||
}
|
}
|
||||||
|
@ -804,8 +804,8 @@ void blkcg_deactivate_policy(struct request_queue *q,
|
||||||
/* grab blkcg lock too while removing @pd from @blkg */
|
/* grab blkcg lock too while removing @pd from @blkg */
|
||||||
spin_lock(&blkg->blkcg->lock);
|
spin_lock(&blkg->blkcg->lock);
|
||||||
|
|
||||||
if (pol->ops.pd_exit_fn)
|
if (pol->pd_exit_fn)
|
||||||
pol->ops.pd_exit_fn(blkg);
|
pol->pd_exit_fn(blkg);
|
||||||
|
|
||||||
kfree(blkg->pd[pol->plid]);
|
kfree(blkg->pd[pol->plid]);
|
||||||
blkg->pd[pol->plid] = NULL;
|
blkg->pd[pol->plid] = NULL;
|
||||||
|
|
|
@ -99,19 +99,17 @@ typedef void (blkcg_pol_init_pd_fn)(struct blkcg_gq *blkg);
|
||||||
typedef void (blkcg_pol_exit_pd_fn)(struct blkcg_gq *blkg);
|
typedef void (blkcg_pol_exit_pd_fn)(struct blkcg_gq *blkg);
|
||||||
typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkcg_gq *blkg);
|
typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkcg_gq *blkg);
|
||||||
|
|
||||||
struct blkcg_policy_ops {
|
|
||||||
blkcg_pol_init_pd_fn *pd_init_fn;
|
|
||||||
blkcg_pol_exit_pd_fn *pd_exit_fn;
|
|
||||||
blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct blkcg_policy {
|
struct blkcg_policy {
|
||||||
struct blkcg_policy_ops ops;
|
|
||||||
int plid;
|
int plid;
|
||||||
/* policy specific private data size */
|
/* policy specific private data size */
|
||||||
size_t pd_size;
|
size_t pd_size;
|
||||||
/* cgroup files for the policy */
|
/* cgroup files for the policy */
|
||||||
struct cftype *cftypes;
|
struct cftype *cftypes;
|
||||||
|
|
||||||
|
/* operations */
|
||||||
|
blkcg_pol_init_pd_fn *pd_init_fn;
|
||||||
|
blkcg_pol_exit_pd_fn *pd_exit_fn;
|
||||||
|
blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct blkcg blkcg_root;
|
extern struct blkcg blkcg_root;
|
||||||
|
|
|
@ -1100,13 +1100,12 @@ static void throtl_shutdown_wq(struct request_queue *q)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct blkcg_policy blkcg_policy_throtl = {
|
static struct blkcg_policy blkcg_policy_throtl = {
|
||||||
.ops = {
|
.pd_size = sizeof(struct throtl_grp),
|
||||||
.pd_init_fn = throtl_pd_init,
|
.cftypes = throtl_files,
|
||||||
.pd_exit_fn = throtl_pd_exit,
|
|
||||||
.pd_reset_stats_fn = throtl_pd_reset_stats,
|
.pd_init_fn = throtl_pd_init,
|
||||||
},
|
.pd_exit_fn = throtl_pd_exit,
|
||||||
.pd_size = sizeof(struct throtl_grp),
|
.pd_reset_stats_fn = throtl_pd_reset_stats,
|
||||||
.cftypes = throtl_files,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
|
bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
|
||||||
|
|
|
@ -4165,12 +4165,11 @@ static struct elevator_type iosched_cfq = {
|
||||||
|
|
||||||
#ifdef CONFIG_CFQ_GROUP_IOSCHED
|
#ifdef CONFIG_CFQ_GROUP_IOSCHED
|
||||||
static struct blkcg_policy blkcg_policy_cfq = {
|
static struct blkcg_policy blkcg_policy_cfq = {
|
||||||
.ops = {
|
.pd_size = sizeof(struct cfq_group),
|
||||||
.pd_init_fn = cfq_pd_init,
|
.cftypes = cfq_blkcg_files,
|
||||||
.pd_reset_stats_fn = cfq_pd_reset_stats,
|
|
||||||
},
|
.pd_init_fn = cfq_pd_init,
|
||||||
.pd_size = sizeof(struct cfq_group),
|
.pd_reset_stats_fn = cfq_pd_reset_stats,
|
||||||
.cftypes = cfq_blkcg_files,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue