aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-16 16:57:24 -0400
committerJens Axboe <axboe@kernel.dk>2012-04-20 04:06:16 -0400
commit36558c8a30e121f97b5852ae33e28081af21bdbf (patch)
treede9b361baf71b0b893d4053ac061f8e160ecfd37 /block/blk-cgroup.h
parent54e7ed12bad1e3aa2a28558fab6850240465f973 (diff)
blkcg: style cleanups for blk-cgroup.h
* Update indentation on struct field declarations. * Uniformly don't use "extern" on function declarations. * Merge the two #ifdef CONFIG_BLK_CGROUP blocks. All changes in this patch are cosmetic. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h108
1 files changed, 52 insertions, 56 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index c524267e4f7f..b347aa08d166 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -38,15 +38,15 @@ enum blkg_rwstat_type {
38}; 38};
39 39
40struct blkio_cgroup { 40struct blkio_cgroup {
41 struct cgroup_subsys_state css; 41 struct cgroup_subsys_state css;
42 spinlock_t lock; 42 spinlock_t lock;
43 struct hlist_head blkg_list; 43 struct hlist_head blkg_list;
44 44
45 /* for policies to test whether associated blkcg has changed */ 45 /* for policies to test whether associated blkcg has changed */
46 uint64_t id; 46 uint64_t id;
47 47
48 /* TODO: per-policy storage in blkio_cgroup */ 48 /* TODO: per-policy storage in blkio_cgroup */
49 unsigned int cfq_weight; /* belongs to cfq */ 49 unsigned int cfq_weight; /* belongs to cfq */
50}; 50};
51 51
52struct blkg_stat { 52struct blkg_stat {
@@ -62,27 +62,27 @@ struct blkg_rwstat {
62/* per-blkg per-policy data */ 62/* per-blkg per-policy data */
63struct blkg_policy_data { 63struct blkg_policy_data {
64 /* the blkg this per-policy data belongs to */ 64 /* the blkg this per-policy data belongs to */
65 struct blkio_group *blkg; 65 struct blkio_group *blkg;
66 66
67 /* used during policy activation */ 67 /* used during policy activation */
68 struct list_head alloc_node; 68 struct list_head alloc_node;
69 69
70 /* pol->pdata_size bytes of private data used by policy impl */ 70 /* pol->pdata_size bytes of private data used by policy impl */
71 char pdata[] __aligned(__alignof__(unsigned long long)); 71 char pdata[] __aligned(__alignof__(unsigned long long));
72}; 72};
73 73
74struct blkio_group { 74struct blkio_group {
75 /* Pointer to the associated request_queue */ 75 /* Pointer to the associated request_queue */
76 struct request_queue *q; 76 struct request_queue *q;
77 struct list_head q_node; 77 struct list_head q_node;
78 struct hlist_node blkcg_node; 78 struct hlist_node blkcg_node;
79 struct blkio_cgroup *blkcg; 79 struct blkio_cgroup *blkcg;
80 /* reference count */ 80 /* reference count */
81 int refcnt; 81 int refcnt;
82 82
83 struct blkg_policy_data *pd[BLKCG_MAX_POLS]; 83 struct blkg_policy_data *pd[BLKCG_MAX_POLS];
84 84
85 struct rcu_head rcu_head; 85 struct rcu_head rcu_head;
86}; 86};
87 87
88typedef void (blkio_init_group_fn)(struct blkio_group *blkg); 88typedef void (blkio_init_group_fn)(struct blkio_group *blkg);
@@ -90,29 +90,39 @@ typedef void (blkio_exit_group_fn)(struct blkio_group *blkg);
90typedef void (blkio_reset_group_stats_fn)(struct blkio_group *blkg); 90typedef void (blkio_reset_group_stats_fn)(struct blkio_group *blkg);
91 91
92struct blkio_policy_ops { 92struct blkio_policy_ops {
93 blkio_init_group_fn *blkio_init_group_fn; 93 blkio_init_group_fn *blkio_init_group_fn;
94 blkio_exit_group_fn *blkio_exit_group_fn; 94 blkio_exit_group_fn *blkio_exit_group_fn;
95 blkio_reset_group_stats_fn *blkio_reset_group_stats_fn; 95 blkio_reset_group_stats_fn *blkio_reset_group_stats_fn;
96}; 96};
97 97
98struct blkio_policy_type { 98struct blkio_policy_type {
99 struct blkio_policy_ops ops; 99 struct blkio_policy_ops ops;
100 int plid; 100 int plid;
101 size_t pdata_size; /* policy specific private data size */ 101 /* policy specific private data size */
102 struct cftype *cftypes; /* cgroup files for the policy */ 102 size_t pdata_size;
103 /* cgroup files for the policy */
104 struct cftype *cftypes;
103}; 105};
104 106
105extern int blkcg_init_queue(struct request_queue *q); 107extern struct blkio_cgroup blkio_root_cgroup;
106extern void blkcg_drain_queue(struct request_queue *q); 108
107extern void blkcg_exit_queue(struct request_queue *q); 109struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup);
110struct blkio_cgroup *bio_blkio_cgroup(struct bio *bio);
111struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg,
112 struct request_queue *q);
113struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg,
114 struct request_queue *q);
115int blkcg_init_queue(struct request_queue *q);
116void blkcg_drain_queue(struct request_queue *q);
117void blkcg_exit_queue(struct request_queue *q);
108 118
109/* Blkio controller policy registration */ 119/* Blkio controller policy registration */
110extern int blkio_policy_register(struct blkio_policy_type *); 120int blkio_policy_register(struct blkio_policy_type *);
111extern void blkio_policy_unregister(struct blkio_policy_type *); 121void blkio_policy_unregister(struct blkio_policy_type *);
112extern int blkcg_activate_policy(struct request_queue *q, 122int blkcg_activate_policy(struct request_queue *q,
113 const struct blkio_policy_type *pol); 123 const struct blkio_policy_type *pol);
114extern void blkcg_deactivate_policy(struct request_queue *q, 124void blkcg_deactivate_policy(struct request_queue *q,
115 const struct blkio_policy_type *pol); 125 const struct blkio_policy_type *pol);
116 126
117void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, 127void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg,
118 u64 (*prfill)(struct seq_file *, void *, int), 128 u64 (*prfill)(struct seq_file *, void *, int),
@@ -125,9 +135,9 @@ u64 blkg_prfill_stat(struct seq_file *sf, void *pdata, int off);
125u64 blkg_prfill_rwstat(struct seq_file *sf, void *pdata, int off); 135u64 blkg_prfill_rwstat(struct seq_file *sf, void *pdata, int off);
126 136
127struct blkg_conf_ctx { 137struct blkg_conf_ctx {
128 struct gendisk *disk; 138 struct gendisk *disk;
129 struct blkio_group *blkg; 139 struct blkio_group *blkg;
130 u64 v; 140 u64 v;
131}; 141};
132 142
133int blkg_conf_prep(struct blkio_cgroup *blkcg, 143int blkg_conf_prep(struct blkio_cgroup *blkcg,
@@ -329,7 +339,9 @@ static inline void blkg_rwstat_reset(struct blkg_rwstat *rwstat)
329 memset(rwstat->cnt, 0, sizeof(rwstat->cnt)); 339 memset(rwstat->cnt, 0, sizeof(rwstat->cnt));
330} 340}
331 341
332#else 342#else /* CONFIG_BLK_CGROUP */
343
344struct cgroup;
333 345
334struct blkio_group { 346struct blkio_group {
335}; 347};
@@ -337,6 +349,9 @@ struct blkio_group {
337struct blkio_policy_type { 349struct blkio_policy_type {
338}; 350};
339 351
352static inline struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }
353static inline struct blkio_cgroup *bio_blkio_cgroup(struct bio *bio) { return NULL; }
354static inline struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, void *key) { return NULL; }
340static inline int blkcg_init_queue(struct request_queue *q) { return 0; } 355static inline int blkcg_init_queue(struct request_queue *q) { return 0; }
341static inline void blkcg_drain_queue(struct request_queue *q) { } 356static inline void blkcg_drain_queue(struct request_queue *q) { }
342static inline void blkcg_exit_queue(struct request_queue *q) { } 357static inline void blkcg_exit_queue(struct request_queue *q) { }
@@ -355,24 +370,5 @@ static inline char *blkg_path(struct blkio_group *blkg) { return NULL; }
355static inline void blkg_get(struct blkio_group *blkg) { } 370static inline void blkg_get(struct blkio_group *blkg) { }
356static inline void blkg_put(struct blkio_group *blkg) { } 371static inline void blkg_put(struct blkio_group *blkg) { }
357 372
358#endif 373#endif /* CONFIG_BLK_CGROUP */
359 374#endif /* _BLK_CGROUP_H */
360#ifdef CONFIG_BLK_CGROUP
361extern struct blkio_cgroup blkio_root_cgroup;
362extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup);
363extern struct blkio_cgroup *bio_blkio_cgroup(struct bio *bio);
364extern struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg,
365 struct request_queue *q);
366struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg,
367 struct request_queue *q);
368#else
369struct cgroup;
370static inline struct blkio_cgroup *
371cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }
372static inline struct blkio_cgroup *
373bio_blkio_cgroup(struct bio *bio) { return NULL; }
374
375static inline struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg,
376 void *key) { return NULL; }
377#endif
378#endif /* _BLK_CGROUP_H */