4 #include <linux/radix-tree.h>
5 #include <linux/rcupdate.h>
6 #include <linux/workqueue.h>
14 struct request_queue *q;
15 struct io_context *ioc;
17 struct list_head q_node;
18 struct hlist_node ioc_node;
20 unsigned long changed;
21 struct rcu_head rcu_head;
23 void (*exit)(struct io_cq *);
24 void (*release)(struct io_cq *);
28 * I/O subsystem state of the associated processes. It is refcounted
29 * and kmalloc'ed. These could be shared between processes.
32 atomic_long_t refcount;
35 /* all the fields below are protected by this lock */
38 unsigned short ioprio;
41 * For request batching
43 int nr_batch_requests; /* Number of requests left in the batch */
44 unsigned long last_waited; /* Time last woken after wait for request */
46 struct radix_tree_root icq_tree;
47 struct io_cq __rcu *icq_hint;
48 struct hlist_head icq_list;
50 struct work_struct release_work;
53 static inline struct io_context *ioc_task_link(struct io_context *ioc)
56 * if ref count is zero, don't allow sharing (ioc is going away, it's
59 if (ioc && atomic_long_inc_not_zero(&ioc->refcount)) {
60 atomic_inc(&ioc->nr_tasks);
69 void put_io_context(struct io_context *ioc, struct request_queue *locked_q);
70 void exit_io_context(struct task_struct *task);
71 struct io_context *get_task_io_context(struct task_struct *task,
72 gfp_t gfp_flags, int node);
73 void ioc_ioprio_changed(struct io_context *ioc, int ioprio);
74 void ioc_cgroup_changed(struct io_context *ioc);
77 static inline void put_io_context(struct io_context *ioc,
78 struct request_queue *locked_q) { }
79 static inline void exit_io_context(struct task_struct *task) { }