x86: local.h fix checkpatch warnings
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / linux / iocontext.h
blob593b222d9dcc25334be5ca6d05dc0a5ab413f5f5
1 #ifndef IOCONTEXT_H
2 #define IOCONTEXT_H
4 #include <linux/radix-tree.h>
6 /*
7 * This is the per-process anticipatory I/O scheduler state.
8 */
9 struct as_io_context {
10 spinlock_t lock;
12 void (*dtor)(struct as_io_context *aic); /* destructor */
13 void (*exit)(struct as_io_context *aic); /* called on task exit */
15 unsigned long state;
16 atomic_t nr_queued; /* queued reads & sync writes */
17 atomic_t nr_dispatched; /* number of requests gone to the drivers */
19 /* IO History tracking */
20 /* Thinktime */
21 unsigned long last_end_request;
22 unsigned long ttime_total;
23 unsigned long ttime_samples;
24 unsigned long ttime_mean;
25 /* Layout pattern */
26 unsigned int seek_samples;
27 sector_t last_request_pos;
28 u64 seek_total;
29 sector_t seek_mean;
32 struct cfq_queue;
33 struct cfq_io_context {
34 void *key;
35 unsigned long dead_key;
37 struct cfq_queue *cfqq[2];
39 struct io_context *ioc;
41 unsigned long last_end_request;
42 sector_t last_request_pos;
44 unsigned long ttime_total;
45 unsigned long ttime_samples;
46 unsigned long ttime_mean;
48 unsigned int seek_samples;
49 u64 seek_total;
50 sector_t seek_mean;
52 struct list_head queue_list;
54 void (*dtor)(struct io_context *); /* destructor */
55 void (*exit)(struct io_context *); /* called on task exit */
59 * I/O subsystem state of the associated processes. It is refcounted
60 * and kmalloc'ed. These could be shared between processes.
62 struct io_context {
63 atomic_t refcount;
64 atomic_t nr_tasks;
66 /* all the fields below are protected by this lock */
67 spinlock_t lock;
69 unsigned short ioprio;
70 unsigned short ioprio_changed;
73 * For request batching
75 unsigned long last_waited; /* Time last woken after wait for request */
76 int nr_batch_requests; /* Number of requests left in the batch */
78 struct as_io_context *aic;
79 struct radix_tree_root radix_root;
80 void *ioc_data;
83 static inline struct io_context *ioc_task_link(struct io_context *ioc)
86 * if ref count is zero, don't allow sharing (ioc is going away, it's
87 * a race).
89 if (ioc && atomic_inc_not_zero(&ioc->refcount))
90 return ioc;
92 return NULL;
95 #endif