Skip to content

Commit 36558c8

Browse files
htejunaxboe
authored andcommitted
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>
1 parent 54e7ed1 commit 36558c8

1 file changed

Lines changed: 52 additions & 56 deletions

File tree

‎block/blk-cgroup.h‎

Lines changed: 52 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ enum blkg_rwstat_type {
3838
};
3939

4040
struct blkio_cgroup {
41-
struct cgroup_subsys_state css;
42-
spinlock_t lock;
43-
struct hlist_head blkg_list;
41+
struct cgroup_subsys_state css;
42+
spinlock_t lock;
43+
struct hlist_head blkg_list;
4444

4545
/* for policies to test whether associated blkcg has changed */
46-
uint64_t id;
46+
uint64_t id;
4747

4848
/* TODO: per-policy storage in blkio_cgroup */
49-
unsigned int cfq_weight; /* belongs to cfq */
49+
unsigned int cfq_weight; /* belongs to cfq */
5050
};
5151

5252
struct blkg_stat {
@@ -62,57 +62,67 @@ struct blkg_rwstat {
6262
/* per-blkg per-policy data */
6363
struct blkg_policy_data {
6464
/* the blkg this per-policy data belongs to */
65-
struct blkio_group *blkg;
65+
struct blkio_group *blkg;
6666

6767
/* used during policy activation */
68-
struct list_head alloc_node;
68+
struct list_head alloc_node;
6969

7070
/* 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));
7272
};
7373

7474
struct blkio_group {
7575
/* Pointer to the associated request_queue */
76-
struct request_queue *q;
77-
struct list_head q_node;
78-
struct hlist_node blkcg_node;
79-
struct blkio_cgroup *blkcg;
76+
struct request_queue *q;
77+
struct list_head q_node;
78+
struct hlist_node blkcg_node;
79+
struct blkio_cgroup *blkcg;
8080
/* reference count */
81-
int refcnt;
81+
int refcnt;
8282

83-
struct blkg_policy_data *pd[BLKCG_MAX_POLS];
83+
struct blkg_policy_data *pd[BLKCG_MAX_POLS];
8484

85-
struct rcu_head rcu_head;
85+
struct rcu_head rcu_head;
8686
};
8787

8888
typedef void (blkio_init_group_fn)(struct blkio_group *blkg);
8989
typedef void (blkio_exit_group_fn)(struct blkio_group *blkg);
9090
typedef void (blkio_reset_group_stats_fn)(struct blkio_group *blkg);
9191

9292
struct blkio_policy_ops {
93-
blkio_init_group_fn *blkio_init_group_fn;
94-
blkio_exit_group_fn *blkio_exit_group_fn;
95-
blkio_reset_group_stats_fn *blkio_reset_group_stats_fn;
93+
blkio_init_group_fn *blkio_init_group_fn;
94+
blkio_exit_group_fn *blkio_exit_group_fn;
95+
blkio_reset_group_stats_fn *blkio_reset_group_stats_fn;
9696
};
9797

9898
struct blkio_policy_type {
99-
struct blkio_policy_ops ops;
100-
int plid;
101-
size_t pdata_size; /* policy specific private data size */
102-
struct cftype *cftypes; /* cgroup files for the policy */
99+
struct blkio_policy_ops ops;
100+
int plid;
101+
/* policy specific private data size */
102+
size_t pdata_size;
103+
/* cgroup files for the policy */
104+
struct cftype *cftypes;
103105
};
104106

105-
extern int blkcg_init_queue(struct request_queue *q);
106-
extern void blkcg_drain_queue(struct request_queue *q);
107-
extern void blkcg_exit_queue(struct request_queue *q);
107+
extern struct blkio_cgroup blkio_root_cgroup;
108+
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);
108118

109119
/* Blkio controller policy registration */
110-
extern int blkio_policy_register(struct blkio_policy_type *);
111-
extern void blkio_policy_unregister(struct blkio_policy_type *);
112-
extern int blkcg_activate_policy(struct request_queue *q,
113-
const struct blkio_policy_type *pol);
114-
extern void blkcg_deactivate_policy(struct request_queue *q,
115-
const struct blkio_policy_type *pol);
120+
int blkio_policy_register(struct blkio_policy_type *);
121+
void blkio_policy_unregister(struct blkio_policy_type *);
122+
int blkcg_activate_policy(struct request_queue *q,
123+
const struct blkio_policy_type *pol);
124+
void blkcg_deactivate_policy(struct request_queue *q,
125+
const struct blkio_policy_type *pol);
116126

117127
void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg,
118128
u64 (*prfill)(struct seq_file *, void *, int),
@@ -125,9 +135,9 @@ u64 blkg_prfill_stat(struct seq_file *sf, void *pdata, int off);
125135
u64 blkg_prfill_rwstat(struct seq_file *sf, void *pdata, int off);
126136

127137
struct blkg_conf_ctx {
128-
struct gendisk *disk;
129-
struct blkio_group *blkg;
130-
u64 v;
138+
struct gendisk *disk;
139+
struct blkio_group *blkg;
140+
u64 v;
131141
};
132142

133143
int blkg_conf_prep(struct blkio_cgroup *blkcg,
@@ -329,14 +339,19 @@ static inline void blkg_rwstat_reset(struct blkg_rwstat *rwstat)
329339
memset(rwstat->cnt, 0, sizeof(rwstat->cnt));
330340
}
331341

332-
#else
342+
#else /* CONFIG_BLK_CGROUP */
343+
344+
struct cgroup;
333345

334346
struct blkio_group {
335347
};
336348

337349
struct blkio_policy_type {
338350
};
339351

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; }
340355
static inline int blkcg_init_queue(struct request_queue *q) { return 0; }
341356
static inline void blkcg_drain_queue(struct request_queue *q) { }
342357
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; }
355370
static inline void blkg_get(struct blkio_group *blkg) { }
356371
static inline void blkg_put(struct blkio_group *blkg) { }
357372

358-
#endif
359-
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 */
373+
#endif /* CONFIG_BLK_CGROUP */
374+
#endif /* _BLK_CGROUP_H */

0 commit comments

Comments
 (0)