pcmcia: alchemy: fixup wrong comments
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / block / blk-cgroup.h
blob84bf745fa77576898b8c01c13bd68879092bf869
1 #ifndef _BLK_CGROUP_H
2 #define _BLK_CGROUP_H
3 /*
4 * Common Block IO controller cgroup interface
6 * Based on ideas and code from CFQ, CFS and BFQ:
7 * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
9 * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
10 * Paolo Valente <paolo.valente@unimore.it>
12 * Copyright (C) 2009 Vivek Goyal <vgoyal@redhat.com>
13 * Nauman Rafique <nauman@google.com>
16 #include <linux/cgroup.h>
18 #ifdef CONFIG_BLK_CGROUP
20 struct blkio_cgroup {
21 struct cgroup_subsys_state css;
22 unsigned int weight;
23 spinlock_t lock;
24 struct hlist_head blkg_list;
27 struct blkio_group {
28 /* An rcu protected unique identifier for the group */
29 void *key;
30 struct hlist_node blkcg_node;
31 unsigned short blkcg_id;
32 #ifdef CONFIG_DEBUG_BLK_CGROUP
33 /* Store cgroup path */
34 char path[128];
35 /* How many times this group has been removed from service tree */
36 unsigned long dequeue;
37 #endif
38 /* The device MKDEV(major, minor), this group has been created for */
39 dev_t dev;
41 /* total disk time and nr sectors dispatched by this group */
42 unsigned long time;
43 unsigned long sectors;
46 typedef void (blkio_unlink_group_fn) (void *key, struct blkio_group *blkg);
47 typedef void (blkio_update_group_weight_fn) (struct blkio_group *blkg,
48 unsigned int weight);
50 struct blkio_policy_ops {
51 blkio_unlink_group_fn *blkio_unlink_group_fn;
52 blkio_update_group_weight_fn *blkio_update_group_weight_fn;
55 struct blkio_policy_type {
56 struct list_head list;
57 struct blkio_policy_ops ops;
60 /* Blkio controller policy registration */
61 extern void blkio_policy_register(struct blkio_policy_type *);
62 extern void blkio_policy_unregister(struct blkio_policy_type *);
64 #else
66 struct blkio_group {
69 struct blkio_policy_type {
72 static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { }
73 static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { }
75 #endif
77 #define BLKIO_WEIGHT_MIN 100
78 #define BLKIO_WEIGHT_MAX 1000
79 #define BLKIO_WEIGHT_DEFAULT 500
81 #ifdef CONFIG_DEBUG_BLK_CGROUP
82 static inline char *blkg_path(struct blkio_group *blkg)
84 return blkg->path;
86 void blkiocg_update_blkio_group_dequeue_stats(struct blkio_group *blkg,
87 unsigned long dequeue);
88 #else
89 static inline char *blkg_path(struct blkio_group *blkg) { return NULL; }
90 static inline void blkiocg_update_blkio_group_dequeue_stats(
91 struct blkio_group *blkg, unsigned long dequeue) {}
92 #endif
94 #ifdef CONFIG_BLK_CGROUP
95 extern struct blkio_cgroup blkio_root_cgroup;
96 extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup);
97 extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
98 struct blkio_group *blkg, void *key, dev_t dev);
99 extern int blkiocg_del_blkio_group(struct blkio_group *blkg);
100 extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg,
101 void *key);
102 void blkiocg_update_blkio_group_stats(struct blkio_group *blkg,
103 unsigned long time, unsigned long sectors);
104 #else
105 struct cgroup;
106 static inline struct blkio_cgroup *
107 cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }
109 static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
110 struct blkio_group *blkg, void *key, dev_t dev)
114 static inline int
115 blkiocg_del_blkio_group(struct blkio_group *blkg) { return 0; }
117 static inline struct blkio_group *
118 blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key) { return NULL; }
119 static inline void blkiocg_update_blkio_group_stats(struct blkio_group *blkg,
120 unsigned long time, unsigned long sectors)
123 #endif
124 #endif /* _BLK_CGROUP_H */