Commit 3c798398 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

blkcg: mass rename of blkcg API

During the recent blkcg cleanup, most of blkcg API has changed to such
extent that mass renaming wouldn't cause any noticeable pain.  Take
the chance and cleanup the naming.

* Rename blkio_cgroup to blkcg.

* Drop blkio / blkiocg prefixes and consistently use blkcg.

* Rename blkio_group to blkcg_gq, which is consistent with io_cq but
  keep the blkg prefix / variable name.

* Rename policy method type and field names to signify they're dealing
  with policy data.

* Rename blkio_policy_type to blkcg_policy.

This patch doesn't cause any functional change.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 36558c8a
This diff is collapsed.
......@@ -37,7 +37,7 @@ enum blkg_rwstat_type {
BLKG_RWSTAT_TOTAL = BLKG_RWSTAT_NR,
};
struct blkio_cgroup {
struct blkcg {
struct cgroup_subsys_state css;
spinlock_t lock;
struct hlist_head blkg_list;
......@@ -45,7 +45,7 @@ struct blkio_cgroup {
/* for policies to test whether associated blkcg has changed */
uint64_t id;
/* TODO: per-policy storage in blkio_cgroup */
/* TODO: per-policy storage in blkcg */
unsigned int cfq_weight; /* belongs to cfq */
};
......@@ -62,7 +62,7 @@ struct blkg_rwstat {
/* per-blkg per-policy data */
struct blkg_policy_data {
/* the blkg this per-policy data belongs to */
struct blkio_group *blkg;
struct blkcg_gq *blkg;
/* used during policy activation */
struct list_head alloc_node;
......@@ -71,12 +71,13 @@ struct blkg_policy_data {
char pdata[] __aligned(__alignof__(unsigned long long));
};
struct blkio_group {
/* association between a blk cgroup and a request queue */
struct blkcg_gq {
/* Pointer to the associated request_queue */
struct request_queue *q;
struct list_head q_node;
struct hlist_node blkcg_node;
struct blkio_cgroup *blkcg;
struct blkcg *blkcg;
/* reference count */
int refcnt;
......@@ -85,18 +86,18 @@ struct blkio_group {
struct rcu_head rcu_head;
};
typedef void (blkio_init_group_fn)(struct blkio_group *blkg);
typedef void (blkio_exit_group_fn)(struct blkio_group *blkg);
typedef void (blkio_reset_group_stats_fn)(struct blkio_group *blkg);
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_reset_pd_stats_fn)(struct blkcg_gq *blkg);
struct blkio_policy_ops {
blkio_init_group_fn *blkio_init_group_fn;
blkio_exit_group_fn *blkio_exit_group_fn;
blkio_reset_group_stats_fn *blkio_reset_group_stats_fn;
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 blkio_policy_type {
struct blkio_policy_ops ops;
struct blkcg_policy {
struct blkcg_policy_ops ops;
int plid;
/* policy specific private data size */
size_t pdata_size;
......@@ -104,29 +105,28 @@ struct blkio_policy_type {
struct cftype *cftypes;
};
extern struct blkio_cgroup blkio_root_cgroup;
extern struct blkcg blkcg_root;
struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup);
struct blkio_cgroup *bio_blkio_cgroup(struct bio *bio);
struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg,
struct request_queue *q);
struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg,
struct request_queue *q);
struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup);
struct blkcg *bio_blkcg(struct bio *bio);
struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, struct request_queue *q);
struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg,
struct request_queue *q);
int blkcg_init_queue(struct request_queue *q);
void blkcg_drain_queue(struct request_queue *q);
void blkcg_exit_queue(struct request_queue *q);
/* Blkio controller policy registration */
int blkio_policy_register(struct blkio_policy_type *);
void blkio_policy_unregister(struct blkio_policy_type *);
int blkcg_policy_register(struct blkcg_policy *pol);
void blkcg_policy_unregister(struct blkcg_policy *pol);
int blkcg_activate_policy(struct request_queue *q,
const struct blkio_policy_type *pol);
const struct blkcg_policy *pol);
void blkcg_deactivate_policy(struct request_queue *q,
const struct blkio_policy_type *pol);
const struct blkcg_policy *pol);
void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg,
void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg,
u64 (*prfill)(struct seq_file *, void *, int),
const struct blkio_policy_type *pol, int data,
const struct blkcg_policy *pol, int data,
bool show_total);
u64 __blkg_prfill_u64(struct seq_file *sf, void *pdata, u64 v);
u64 __blkg_prfill_rwstat(struct seq_file *sf, void *pdata,
......@@ -136,13 +136,12 @@ u64 blkg_prfill_rwstat(struct seq_file *sf, void *pdata, int off);
struct blkg_conf_ctx {
struct gendisk *disk;
struct blkio_group *blkg;
struct blkcg_gq *blkg;
u64 v;
};
int blkg_conf_prep(struct blkio_cgroup *blkcg,
const struct blkio_policy_type *pol, const char *input,
struct blkg_conf_ctx *ctx);
int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
const char *input, struct blkg_conf_ctx *ctx);
void blkg_conf_finish(struct blkg_conf_ctx *ctx);
......@@ -153,8 +152,8 @@ void blkg_conf_finish(struct blkg_conf_ctx *ctx);
*
* Return pointer to private data associated with the @blkg-@pol pair.
*/
static inline void *blkg_to_pdata(struct blkio_group *blkg,
struct blkio_policy_type *pol)
static inline void *blkg_to_pdata(struct blkcg_gq *blkg,
struct blkcg_policy *pol)
{
return blkg ? blkg->pd[pol->plid]->pdata : NULL;
}
......@@ -165,7 +164,7 @@ static inline void *blkg_to_pdata(struct blkio_group *blkg,
*
* @pdata is policy private data. Determine the blkg it's associated with.
*/
static inline struct blkio_group *pdata_to_blkg(void *pdata)
static inline struct blkcg_gq *pdata_to_blkg(void *pdata)
{
if (pdata) {
struct blkg_policy_data *pd =
......@@ -183,7 +182,7 @@ static inline struct blkio_group *pdata_to_blkg(void *pdata)
*
* Format the path of the cgroup of @blkg into @buf.
*/
static inline int blkg_path(struct blkio_group *blkg, char *buf, int buflen)
static inline int blkg_path(struct blkcg_gq *blkg, char *buf, int buflen)
{
int ret;
......@@ -201,14 +200,14 @@ static inline int blkg_path(struct blkio_group *blkg, char *buf, int buflen)
*
* The caller should be holding queue_lock and an existing reference.
*/
static inline void blkg_get(struct blkio_group *blkg)
static inline void blkg_get(struct blkcg_gq *blkg)
{
lockdep_assert_held(blkg->q->queue_lock);
WARN_ON_ONCE(!blkg->refcnt);
blkg->refcnt++;
}
void __blkg_release(struct blkio_group *blkg);
void __blkg_release(struct blkcg_gq *blkg);
/**
* blkg_put - put a blkg reference
......@@ -216,7 +215,7 @@ void __blkg_release(struct blkio_group *blkg);
*
* The caller should be holding queue_lock.
*/
static inline void blkg_put(struct blkio_group *blkg)
static inline void blkg_put(struct blkcg_gq *blkg)
{
lockdep_assert_held(blkg->q->queue_lock);
WARN_ON_ONCE(blkg->refcnt <= 0);
......@@ -343,32 +342,32 @@ static inline void blkg_rwstat_reset(struct blkg_rwstat *rwstat)
struct cgroup;
struct blkio_group {
struct blkcg_gq {
};
struct blkio_policy_type {
struct blkcg_policy {
};
static inline struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }
static inline struct blkio_cgroup *bio_blkio_cgroup(struct bio *bio) { return NULL; }
static inline struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, void *key) { return NULL; }
static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup) { return NULL; }
static inline struct blkcg *bio_blkcg(struct bio *bio) { return NULL; }
static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; }
static inline int blkcg_init_queue(struct request_queue *q) { return 0; }
static inline void blkcg_drain_queue(struct request_queue *q) { }
static inline void blkcg_exit_queue(struct request_queue *q) { }
static inline int blkio_policy_register(struct blkio_policy_type *blkiop) { return 0; }
static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { }
static inline int blkcg_policy_register(struct blkcg_policy *pol) { return 0; }
static inline void blkcg_policy_unregister(struct blkcg_policy *pol) { }
static inline int blkcg_activate_policy(struct request_queue *q,
const struct blkio_policy_type *pol) { return 0; }
const struct blkcg_policy *pol) { return 0; }
static inline void blkcg_deactivate_policy(struct request_queue *q,
const struct blkio_policy_type *pol) { }
static inline void *blkg_to_pdata(struct blkio_group *blkg,
struct blkio_policy_type *pol) { return NULL; }
static inline struct blkio_group *pdata_to_blkg(void *pdata,
struct blkio_policy_type *pol) { return NULL; }
static inline char *blkg_path(struct blkio_group *blkg) { return NULL; }
static inline void blkg_get(struct blkio_group *blkg) { }
static inline void blkg_put(struct blkio_group *blkg) { }
const struct blkcg_policy *pol) { }
static inline void *blkg_to_pdata(struct blkcg_gq *blkg,
struct blkcg_policy *pol) { return NULL; }
static inline struct blkcg_gq *pdata_to_blkg(void *pdata,
struct blkcg_policy *pol) { return NULL; }
static inline char *blkg_path(struct blkcg_gq *blkg) { return NULL; }
static inline void blkg_get(struct blkcg_gq *blkg) { }
static inline void blkg_put(struct blkcg_gq *blkg) { }
#endif /* CONFIG_BLK_CGROUP */
#endif /* _BLK_CGROUP_H */
......@@ -21,7 +21,7 @@ static int throtl_quantum = 32;
/* Throttling is performed over 100ms slice and after that slice is renewed */
static unsigned long throtl_slice = HZ/10; /* 100 ms */
static struct blkio_policy_type blkio_policy_throtl;
static struct blkcg_policy blkcg_policy_throtl;
/* A workqueue to queue throttle related work */
static struct workqueue_struct *kthrotld_workqueue;
......@@ -120,12 +120,12 @@ static LIST_HEAD(tg_stats_alloc_list);
static void tg_stats_alloc_fn(struct work_struct *);
static DECLARE_DELAYED_WORK(tg_stats_alloc_work, tg_stats_alloc_fn);
static inline struct throtl_grp *blkg_to_tg(struct blkio_group *blkg)
static inline struct throtl_grp *blkg_to_tg(struct blkcg_gq *blkg)
{
return blkg_to_pdata(blkg, &blkio_policy_throtl);
return blkg_to_pdata(blkg, &blkcg_policy_throtl);
}
static inline struct blkio_group *tg_to_blkg(struct throtl_grp *tg)
static inline struct blkcg_gq *tg_to_blkg(struct throtl_grp *tg)
{
return pdata_to_blkg(tg);
}
......@@ -208,7 +208,7 @@ static void tg_stats_alloc_fn(struct work_struct *work)
goto alloc_stats;
}
static void throtl_init_blkio_group(struct blkio_group *blkg)
static void throtl_pd_init(struct blkcg_gq *blkg)
{
struct throtl_grp *tg = blkg_to_tg(blkg);
......@@ -233,7 +233,7 @@ static void throtl_init_blkio_group(struct blkio_group *blkg)
spin_unlock(&tg_stats_alloc_lock);
}
static void throtl_exit_blkio_group(struct blkio_group *blkg)
static void throtl_pd_exit(struct blkcg_gq *blkg)
{
struct throtl_grp *tg = blkg_to_tg(blkg);
......@@ -244,7 +244,7 @@ static void throtl_exit_blkio_group(struct blkio_group *blkg)
free_percpu(tg->stats_cpu);
}
static void throtl_reset_group_stats(struct blkio_group *blkg)
static void throtl_pd_reset_stats(struct blkcg_gq *blkg)
{
struct throtl_grp *tg = blkg_to_tg(blkg);
int cpu;
......@@ -260,33 +260,33 @@ static void throtl_reset_group_stats(struct blkio_group *blkg)
}
}
static struct
throtl_grp *throtl_lookup_tg(struct throtl_data *td, struct blkio_cgroup *blkcg)
static struct throtl_grp *throtl_lookup_tg(struct throtl_data *td,
struct blkcg *blkcg)
{
/*
* This is the common case when there are no blkio cgroups.
* Avoid lookup in this case
* This is the common case when there are no blkcgs. Avoid lookup
* in this case
*/
if (blkcg == &blkio_root_cgroup)
if (blkcg == &blkcg_root)
return td_root_tg(td);
return blkg_to_tg(blkg_lookup(blkcg, td->queue));
}
static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
struct blkio_cgroup *blkcg)
struct blkcg *blkcg)
{
struct request_queue *q = td->queue;
struct throtl_grp *tg = NULL;
/*
* This is the common case when there are no blkio cgroups.
* Avoid lookup in this case
* This is the common case when there are no blkcgs. Avoid lookup
* in this case
*/
if (blkcg == &blkio_root_cgroup) {
if (blkcg == &blkcg_root) {
tg = td_root_tg(td);
} else {
struct blkio_group *blkg;
struct blkcg_gq *blkg;
blkg = blkg_lookup_create(blkcg, q);
......@@ -665,7 +665,7 @@ static bool tg_may_dispatch(struct throtl_data *td, struct throtl_grp *tg,
return 0;
}
static void throtl_update_dispatch_stats(struct blkio_group *blkg, u64 bytes,
static void throtl_update_dispatch_stats(struct blkcg_gq *blkg, u64 bytes,
int rw)
{
struct throtl_grp *tg = blkg_to_tg(blkg);
......@@ -822,7 +822,7 @@ static int throtl_select_dispatch(struct throtl_data *td, struct bio_list *bl)
static void throtl_process_limit_change(struct throtl_data *td)
{
struct request_queue *q = td->queue;
struct blkio_group *blkg, *n;
struct blkcg_gq *blkg, *n;
if (!td->limits_changed)
return;
......@@ -951,9 +951,9 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf, void *pdata, int off)
static int tg_print_cpu_rwstat(struct cgroup *cgrp, struct cftype *cft,
struct seq_file *sf)
{
struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp);
struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, &blkio_policy_throtl,
blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, &blkcg_policy_throtl,
cft->private, true);
return 0;
}
......@@ -979,29 +979,29 @@ static u64 tg_prfill_conf_uint(struct seq_file *sf, void *pdata, int off)
static int tg_print_conf_u64(struct cgroup *cgrp, struct cftype *cft,
struct seq_file *sf)
{
blkcg_print_blkgs(sf, cgroup_to_blkio_cgroup(cgrp), tg_prfill_conf_u64,
&blkio_policy_throtl, cft->private, false);
blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), tg_prfill_conf_u64,
&blkcg_policy_throtl, cft->private, false);
return 0;
}
static int tg_print_conf_uint(struct cgroup *cgrp, struct cftype *cft,
struct seq_file *sf)
{
blkcg_print_blkgs(sf, cgroup_to_blkio_cgroup(cgrp), tg_prfill_conf_uint,
&blkio_policy_throtl, cft->private, false);
blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), tg_prfill_conf_uint,
&blkcg_policy_throtl, cft->private, false);
return 0;
}
static int tg_set_conf(struct cgroup *cgrp, struct cftype *cft, const char *buf,
bool is_u64)
{
struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp);
struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
struct blkg_conf_ctx ctx;
struct throtl_grp *tg;
struct throtl_data *td;
int ret;
ret = blkg_conf_prep(blkcg, &blkio_policy_throtl, buf, &ctx);
ret = blkg_conf_prep(blkcg, &blkcg_policy_throtl, buf, &ctx);
if (ret)
return ret;
......@@ -1086,11 +1086,11 @@ static void throtl_shutdown_wq(struct request_queue *q)
cancel_delayed_work_sync(&td->throtl_work);
}
static struct blkio_policy_type blkio_policy_throtl = {
static struct blkcg_policy blkcg_policy_throtl = {
.ops = {
.blkio_init_group_fn = throtl_init_blkio_group,
.blkio_exit_group_fn = throtl_exit_blkio_group,
.blkio_reset_group_stats_fn = throtl_reset_group_stats,
.pd_init_fn = throtl_pd_init,
.pd_exit_fn = throtl_pd_exit,
.pd_reset_stats_fn = throtl_pd_reset_stats,
},
.pdata_size = sizeof(struct throtl_grp),
.cftypes = throtl_files,
......@@ -1101,7 +1101,7 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
struct throtl_data *td = q->td;
struct throtl_grp *tg;
bool rw = bio_data_dir(bio), update_disptime = true;
struct blkio_cgroup *blkcg;
struct blkcg *blkcg;
bool throttled = false;
if (bio->bi_rw & REQ_THROTTLED) {
......@@ -1118,7 +1118,7 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
* just update the dispatch stats in lockless manner and return.
*/
rcu_read_lock();
blkcg = bio_blkio_cgroup(bio);
blkcg = bio_blkcg(bio);
tg = throtl_lookup_tg(td, blkcg);
if (tg) {
if (tg_no_rule_group(tg, rw)) {
......@@ -1243,7 +1243,7 @@ int blk_throtl_init(struct request_queue *q)
td->queue = q;
/* activate policy */
ret = blkcg_activate_policy(q, &blkio_policy_throtl);
ret = blkcg_activate_policy(q, &blkcg_policy_throtl);
if (ret)
kfree(td);
return ret;
......@@ -1253,7 +1253,7 @@ void blk_throtl_exit(struct request_queue *q)
{
BUG_ON(!q->td);
throtl_shutdown_wq(q);
blkcg_deactivate_policy(q, &blkio_policy_throtl);
blkcg_deactivate_policy(q, &blkcg_policy_throtl);
kfree(q->td);
}
......@@ -1263,7 +1263,7 @@ static int __init throtl_init(void)
if (!kthrotld_workqueue)
panic("Failed to create kthrotld\n");
return blkio_policy_register(&blkio_policy_throtl);
return blkcg_policy_register(&blkcg_policy_throtl);
}
module_init(throtl_init);
......@@ -17,7 +17,7 @@
#include "blk.h"
#include "blk-cgroup.h"
static struct blkio_policy_type blkio_policy_cfq __maybe_unused;
static struct blkcg_policy blkcg_policy_cfq __maybe_unused;
/*
* tunables
......@@ -202,7 +202,7 @@ struct cfqg_stats {
struct blkg_stat dequeue;
/* total time spent waiting for it to be assigned a timeslice. */
struct blkg_stat group_wait_time;
/* time spent idling for this blkio_group */
/* time spent idling for this blkcg_gq */
struct blkg_stat idle_time;
/* total time with empty current active q with other requests queued */
struct blkg_stat empty_time;
......@@ -553,12 +553,12 @@ static inline void cfqg_stats_update_avg_queue_size(struct cfq_group *cfqg) { }
#ifdef CONFIG_CFQ_GROUP_IOSCHED
static inline struct cfq_group *blkg_to_cfqg(struct blkio_group *blkg)
static inline struct cfq_group *blkg_to_cfqg(struct blkcg_gq *blkg)
{
return blkg_to_pdata(blkg, &blkio_policy_cfq);
return blkg_to_pdata(blkg, &blkcg_policy_cfq);
}
static inline struct blkio_group *cfqg_to_blkg(struct cfq_group *cfqg)
static inline struct blkcg_gq *cfqg_to_blkg(struct cfq_group *cfqg)
{
return pdata_to_blkg(cfqg);
}
......@@ -637,7 +637,7 @@ static inline void cfqg_stats_update_completion(struct cfq_group *cfqg,
io_start_time - start_time);
}
static void cfqg_stats_reset(struct blkio_group *blkg)
static void cfq_pd_reset_stats(struct blkcg_gq *blkg)
{
struct cfq_group *cfqg = blkg_to_cfqg(blkg);
struct cfqg_stats *stats = &cfqg->stats;
......@@ -662,8 +662,8 @@ static void cfqg_stats_reset(struct blkio_group *blkg)
#else /* CONFIG_CFQ_GROUP_IOSCHED */
static inline struct cfq_group *blkg_to_cfqg(struct blkio_group *blkg) { return NULL; }
static inline struct blkio_group *cfqg_to_blkg(struct cfq_group *cfqg) { return NULL; }
static inline struct cfq_group *blkg_to_cfqg(struct blkcg_gq *blkg) { return NULL; }
static inline struct blkcg_gq *cfqg_to_blkg(struct cfq_group *cfqg) { return NULL; }
static inline void cfqg_get(struct cfq_group *cfqg) { }
static inline void cfqg_put(struct cfq_group *cfqg) { }
......@@ -1331,7 +1331,7 @@ static void cfq_init_cfqg_base(struct cfq_group *cfqg)
}
#ifdef CONFIG_CFQ_GROUP_IOSCHED
static void cfq_init_blkio_group(struct blkio_group *blkg)
static void cfq_pd_init(struct blkcg_gq *blkg)
{
struct cfq_group *cfqg = blkg_to_cfqg(blkg);
......@@ -1344,16 +1344,16 @@ static void cfq_init_blkio_group(struct blkio_group *blkg)
* be held.
*/
static struct cfq_group *cfq_lookup_create_cfqg(struct cfq_data *cfqd,
struct blkio_cgroup *blkcg)
struct blkcg *blkcg)
{
struct request_queue *q = cfqd->queue;
struct cfq_group *cfqg = NULL;
/* avoid lookup for the common case where there's no blkio cgroup */
if (blkcg == &blkio_root_cgroup) {
/* avoid lookup for the common case where there's no blkcg */
if (blkcg == &blkcg_root) {
cfqg = cfqd->root_group;
} else {
struct blkio_group *blkg;
struct blkcg_gq *blkg;
blkg = blkg_lookup_create(blkcg, q);
if (!IS_ERR(blkg))
......@@ -1386,8 +1386,8 @@ static u64 cfqg_prfill_weight_device(struct seq_file *sf, void *pdata, int off)
static int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft,
struct seq_file *sf)
{
blkcg_print_blkgs(sf, cgroup_to_blkio_cgroup(cgrp),
cfqg_prfill_weight_device, &blkio_policy_cfq, 0,
blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp),
cfqg_prfill_weight_device, &blkcg_policy_cfq, 0,
false);
return 0;
}
......@@ -1395,19 +1395,19 @@ static int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft,
static int cfq_print_weight(struct cgroup *cgrp, struct cftype *cft,
struct seq_file *sf)
{
seq_printf(sf, "%u\n", cgroup_to_blkio_cgroup(cgrp)->cfq_weight);
seq_printf(sf, "%u\n", cgroup_to_blkcg(cgrp)->cfq_weight);
return 0;
}
static int cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft,
const char *buf)
{
struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp);
struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
struct blkg_conf_ctx ctx;
struct cfq_group *cfqg;
int ret;
ret = blkg_conf_prep(blkcg, &blkio_policy_cfq, buf, &ctx);
ret = blkg_conf_prep(blkcg, &blkcg_policy_cfq, buf, &ctx);
if (ret)
return ret;
......@@ -1425,8 +1425,8 @@ static int cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft,
static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val)
{
struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp);
struct blkio_group *blkg;
struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
struct blkcg_gq *blkg;
struct hlist_node *n;
if (val < CFQ_WEIGHT_MIN || val > CFQ_WEIGHT_MAX)
......@@ -1449,9 +1449,9 @@ static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val)
static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft,
struct seq_file *sf)
{
struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp);
struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkio_policy_cfq,
blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkcg_policy_cfq,
cft->private, false);
return 0;
}
......@@ -1459,9 +1459,9 @@ static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft,
static int cfqg_print_rwstat(struct cgroup *cgrp, struct cftype *cft,
struct seq_file *sf)
{
struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp);
struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkio_policy_cfq,
blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkcg_policy_cfq,
cft->private, true);
return 0;
}
......@@ -1485,10 +1485,10 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf, void *pdata, int off)
static int cfqg_print_avg_queue_size(struct cgroup *cgrp, struct cftype *cft,
struct seq_file *sf)
{
struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp);
struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size,
&blkio_policy_cfq, 0, false);
&blkcg_policy_cfq, 0, false);
return 0;
}
#endif /* CONFIG_DEBUG_BLK_CGROUP */
......@@ -1580,7 +1580,7 @@ static struct cftype cfq_blkcg_files[] = {
};
#else /* GROUP_IOSCHED */
static struct cfq_group *cfq_lookup_create_cfqg(struct cfq_data *cfqd,
struct blkio_cgroup *blkcg)
struct blkcg *blkcg)
{
return cfqd->root_group;
}
......@@ -3135,7 +3135,7 @@ static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
uint64_t id;
rcu_read_lock();
id = bio_blkio_cgroup(bio)->id;
id = bio_blkcg(bio)->id;
rcu_read_unlock();
/*
......@@ -3166,14 +3166,14 @@ static struct cfq_queue *
cfq_find_alloc_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
struct bio *bio, gfp_t gfp_mask)
{
struct blkio_cgroup *blkcg;
struct blkcg *blkcg;
struct cfq_queue *cfqq, *new_cfqq = NULL;
struct cfq_group *cfqg;
retry:
rcu_read_lock();
blkcg = bio_blkio_cgroup(bio);
blkcg = bio_blkcg(bio);
cfqg = cfq_lookup_create_cfqg(cfqd, blkcg);
cfqq = cic_to_cfqq(cic, is_sync);
......@@ -3944,14 +3944,14 @@ static void cfq_exit_queue(struct elevator_queue *e)
#ifndef CONFIG_CFQ_GROUP_IOSCHED
kfree(cfqd->root_group);
#endif
blkcg_deactivate_policy(q, &blkio_policy_cfq);
blkcg_deactivate_policy(q, &blkcg_policy_cfq);
kfree(cfqd);
}
static int cfq_init_queue(struct request_queue *q)
{
struct cfq_data *cfqd;
struct blkio_group *blkg __maybe_unused;
struct blkcg_gq *blkg __maybe_unused;
int i, ret;
cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node);
......@@ -3966,7 +3966,7 @@ static int cfq_init_queue(struct request_queue *q)
/* Init root group and prefer root group over other groups by default */
#ifdef CONFIG_CFQ_GROUP_IOSCHED
ret = blkcg_activate_policy(q, &blkio_policy_cfq);
ret = blkcg_activate_policy(q, &blkcg_policy_cfq);
if (ret)
goto out_free;
......@@ -4156,10 +4156,10 @@ static struct elevator_type iosched_cfq = {
};
#ifdef CONFIG_CFQ_GROUP_IOSCHED
static struct blkio_policy_type blkio_policy_cfq = {
static struct blkcg_policy blkcg_policy_cfq = {
.ops = {
.blkio_init_group_fn = cfq_init_blkio_group,
.blkio_reset_group_stats_fn = cfqg_stats_reset,
.pd_init_fn = cfq_pd_init,
.pd_reset_stats_fn = cfq_pd_reset_stats,
},
.pdata_size = sizeof(struct cfq_group),
.cftypes = cfq_blkcg_files,
......@@ -4185,7 +4185,7 @@ static int __init cfq_init(void)
cfq_group_idle = 0;
#endif
ret = blkio_policy_register(&blkio_policy_cfq);
ret = blkcg_policy_register(&blkcg_policy_cfq);
if (ret)
return ret;
......@@ -4202,13 +4202,13 @@ static int __init cfq_init(void)
err_free_pool:
kmem_cache_destroy(cfq_pool);
err_pol_unreg:
blkio_policy_unregister(&blkio_policy_cfq);
blkcg_policy_unregister(&blkcg_policy_cfq);
return ret;
}
static void __exit cfq_exit(void)
{
blkio_policy_unregister(&blkio_policy_cfq);
blkcg_policy_unregister(&blkcg_policy_cfq);
elv_unregister(&iosched_cfq);
kmem_cache_destroy(cfq_pool);
}
......
......@@ -31,7 +31,7 @@ struct blk_trace;
struct request;
struct sg_io_hdr;
struct bsg_job;
struct blkio_group;
struct blkcg_gq;
#define BLKDEV_MIN_RQ 4
#define BLKDEV_MAX_RQ 128 /* Default maximum */
......@@ -371,7 +371,7 @@ struct request_queue {
struct list_head icq_list;
#ifdef CONFIG_BLK_CGROUP
DECLARE_BITMAP (blkcg_pols, BLKCG_MAX_POLS);
struct blkio_group *root_blkg;
struct blkcg_gq *root_blkg;
struct list_head blkg_list;
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment