diff options
author | Tejun Heo <tj@kernel.org> | 2012-04-16 16:57:24 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-04-20 04:06:16 -0400 |
commit | 36558c8a30e121f97b5852ae33e28081af21bdbf (patch) | |
tree | de9b361baf71b0b893d4053ac061f8e160ecfd37 /block/blk-cgroup.h | |
parent | 54e7ed12bad1e3aa2a28558fab6850240465f973 (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.h | 108 |
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 | ||
40 | struct blkio_cgroup { | 40 | struct 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 | ||
52 | struct blkg_stat { | 52 | struct blkg_stat { |
@@ -62,27 +62,27 @@ struct blkg_rwstat { | |||
62 | /* per-blkg per-policy data */ | 62 | /* per-blkg per-policy data */ |
63 | struct blkg_policy_data { | 63 | struct 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 | ||
74 | struct blkio_group { | 74 | struct 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 | ||
88 | typedef void (blkio_init_group_fn)(struct blkio_group *blkg); | 88 | typedef void (blkio_init_group_fn)(struct blkio_group *blkg); |
@@ -90,29 +90,39 @@ typedef void (blkio_exit_group_fn)(struct blkio_group *blkg); | |||
90 | typedef void (blkio_reset_group_stats_fn)(struct blkio_group *blkg); | 90 | typedef void (blkio_reset_group_stats_fn)(struct blkio_group *blkg); |
91 | 91 | ||
92 | struct blkio_policy_ops { | 92 | struct 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 | ||
98 | struct blkio_policy_type { | 98 | struct 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 | ||
105 | extern int blkcg_init_queue(struct request_queue *q); | 107 | extern struct blkio_cgroup blkio_root_cgroup; |
106 | extern void blkcg_drain_queue(struct request_queue *q); | 108 | |
107 | extern void blkcg_exit_queue(struct request_queue *q); | 109 | struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); |
110 | struct blkio_cgroup *bio_blkio_cgroup(struct bio *bio); | ||
111 | struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, | ||
112 | struct request_queue *q); | ||
113 | struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg, | ||
114 | struct request_queue *q); | ||
115 | int blkcg_init_queue(struct request_queue *q); | ||
116 | void blkcg_drain_queue(struct request_queue *q); | ||
117 | void blkcg_exit_queue(struct request_queue *q); | ||
108 | 118 | ||
109 | /* Blkio controller policy registration */ | 119 | /* Blkio controller policy registration */ |
110 | extern int blkio_policy_register(struct blkio_policy_type *); | 120 | int blkio_policy_register(struct blkio_policy_type *); |
111 | extern void blkio_policy_unregister(struct blkio_policy_type *); | 121 | void blkio_policy_unregister(struct blkio_policy_type *); |
112 | extern int blkcg_activate_policy(struct request_queue *q, | 122 | int blkcg_activate_policy(struct request_queue *q, |
113 | const struct blkio_policy_type *pol); | 123 | const struct blkio_policy_type *pol); |
114 | extern void blkcg_deactivate_policy(struct request_queue *q, | 124 | void blkcg_deactivate_policy(struct request_queue *q, |
115 | const struct blkio_policy_type *pol); | 125 | const struct blkio_policy_type *pol); |
116 | 126 | ||
117 | void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, | 127 | void 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); | |||
125 | u64 blkg_prfill_rwstat(struct seq_file *sf, void *pdata, int off); | 135 | u64 blkg_prfill_rwstat(struct seq_file *sf, void *pdata, int off); |
126 | 136 | ||
127 | struct blkg_conf_ctx { | 137 | struct 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 | ||
133 | int blkg_conf_prep(struct blkio_cgroup *blkcg, | 143 | int 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 | |||
344 | struct cgroup; | ||
333 | 345 | ||
334 | struct blkio_group { | 346 | struct blkio_group { |
335 | }; | 347 | }; |
@@ -337,6 +349,9 @@ struct blkio_group { | |||
337 | struct blkio_policy_type { | 349 | struct blkio_policy_type { |
338 | }; | 350 | }; |
339 | 351 | ||
352 | static inline struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; } | ||
353 | static inline struct blkio_cgroup *bio_blkio_cgroup(struct bio *bio) { return NULL; } | ||
354 | static inline struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, void *key) { return NULL; } | ||
340 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } | 355 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } |
341 | static inline void blkcg_drain_queue(struct request_queue *q) { } | 356 | static inline void blkcg_drain_queue(struct request_queue *q) { } |
342 | static inline void blkcg_exit_queue(struct request_queue *q) { } | 357 | static inline void blkcg_exit_queue(struct request_queue *q) { } |
@@ -355,24 +370,5 @@ static inline char *blkg_path(struct blkio_group *blkg) { return NULL; } | |||
355 | static inline void blkg_get(struct blkio_group *blkg) { } | 370 | static inline void blkg_get(struct blkio_group *blkg) { } |
356 | static inline void blkg_put(struct blkio_group *blkg) { } | 371 | static 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 | ||
361 | extern struct blkio_cgroup blkio_root_cgroup; | ||
362 | extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); | ||
363 | extern struct blkio_cgroup *bio_blkio_cgroup(struct bio *bio); | ||
364 | extern struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, | ||
365 | struct request_queue *q); | ||
366 | struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg, | ||
367 | struct request_queue *q); | ||
368 | #else | ||
369 | struct cgroup; | ||
370 | static inline struct blkio_cgroup * | ||
371 | cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; } | ||
372 | static inline struct blkio_cgroup * | ||
373 | bio_blkio_cgroup(struct bio *bio) { return NULL; } | ||
374 | |||
375 | static inline struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, | ||
376 | void *key) { return NULL; } | ||
377 | #endif | ||
378 | #endif /* _BLK_CGROUP_H */ | ||