4 #include <linux/radix-tree.h>
5 #include <linux/rcupdate.h>
8 struct cfq_io_context {
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.
35 atomic_long_t refcount;
38 /* all the fields below are protected by this 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;
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;
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
65 if (ioc && atomic_long_inc_not_zero(&ioc->refcount)) {
66 atomic_inc(&ioc->nr_tasks);
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);
80 static inline void exit_io_context(struct task_struct *task)
85 static inline int put_io_context(struct io_context *ioc)