iwlwifi: fix dma mappings and skbs leak
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / iocontext.h
blobb2eee896dcbc7506f528be8b06a1fe3728aca141
1 #ifndef IOCONTEXT_H
2 #define IOCONTEXT_H
4 #include <linux/radix-tree.h>
5 #include <linux/rcupdate.h>
7 struct cfq_queue;
8 struct cfq_io_context {
9 void *key;
11 struct cfq_queue *cfqq[2];
13 struct io_context *ioc;
15 unsigned long last_end_request;
17 unsigned long ttime_total;
18 unsigned long ttime_samples;
19 unsigned long ttime_mean;
21 struct list_head queue_list;
22 struct hlist_node cic_list;
24 void (*dtor)(struct io_context *); /* destructor */
25 void (*exit)(struct io_context *); /* called on task exit */
27 struct rcu_head rcu_head;
31 * I/O subsystem state of the associated processes. It is refcounted
32 * and kmalloc'ed. These could be shared between processes.
34 struct io_context {
35 atomic_long_t refcount;
36 atomic_t nr_tasks;
38 /* all the fields below are protected by this lock */
39 spinlock_t lock;
41 unsigned short ioprio;
42 unsigned short ioprio_changed;
44 #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
45 unsigned short cgroup_changed;
46 #endif
49 * For request batching
51 int nr_batch_requests; /* Number of requests left in the batch */
52 unsigned long last_waited; /* Time last woken after wait for request */
54 struct radix_tree_root radix_root;
55 struct hlist_head cic_list;
56 void __rcu *ioc_data;
59 static inline struct io_context *ioc_task_link(struct io_context *ioc)
62 * if ref count is zero, don't allow sharing (ioc is going away, it's
63 * a race).
65 if (ioc && atomic_long_inc_not_zero(&ioc->refcount)) {
66 atomic_inc(&ioc->nr_tasks);
67 return ioc;
70 return NULL;
73 struct task_struct;
74 #ifdef CONFIG_BLOCK
75 int put_io_context(struct io_context *ioc);
76 void exit_io_context(struct task_struct *task);
77 struct io_context *get_io_context(gfp_t gfp_flags, int node);
78 struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
79 #else
80 static inline void exit_io_context(struct task_struct *task)
84 struct io_context;
85 static inline int put_io_context(struct io_context *ioc)
87 return 1;
89 #endif
91 #endif