4 #include <linux/radix-tree.h>
5 #include <linux/rcupdate.h>
6 #include <linux/workqueue.h>
10 unsigned long last_end_request;
12 unsigned long ttime_total;
13 unsigned long ttime_samples;
14 unsigned long ttime_mean;
22 struct cfq_io_context {
23 struct request_queue *q;
25 struct cfq_queue *cfqq[2];
27 struct io_context *ioc;
29 struct cfq_ttime ttime;
31 struct list_head queue_list;
32 struct hlist_node cic_list;
34 unsigned long changed;
36 void (*exit)(struct cfq_io_context *);
37 void (*release)(struct cfq_io_context *);
39 struct rcu_head rcu_head;
43 * I/O subsystem state of the associated processes. It is refcounted
44 * and kmalloc'ed. These could be shared between processes.
47 atomic_long_t refcount;
50 /* all the fields below are protected by this lock */
53 unsigned short ioprio;
56 * For request batching
58 int nr_batch_requests; /* Number of requests left in the batch */
59 unsigned long last_waited; /* Time last woken after wait for request */
61 struct radix_tree_root radix_root;
62 struct hlist_head cic_list;
65 struct work_struct release_work;
68 static inline struct io_context *ioc_task_link(struct io_context *ioc)
71 * if ref count is zero, don't allow sharing (ioc is going away, it's
74 if (ioc && atomic_long_inc_not_zero(&ioc->refcount)) {
75 atomic_inc(&ioc->nr_tasks);
84 void put_io_context(struct io_context *ioc, struct request_queue *locked_q);
85 void exit_io_context(struct task_struct *task);
86 struct io_context *get_task_io_context(struct task_struct *task,
87 gfp_t gfp_flags, int node);
88 void ioc_ioprio_changed(struct io_context *ioc, int ioprio);
89 void ioc_cgroup_changed(struct io_context *ioc);
92 static inline void put_io_context(struct io_context *ioc,
93 struct request_queue *locked_q) { }
94 static inline void exit_io_context(struct task_struct *task) { }