4 #include <linux/radix-tree.h>
5 #include <linux/rcupdate.h>
9 unsigned long last_end_request
;
11 unsigned long ttime_total
;
12 unsigned long ttime_samples
;
13 unsigned long ttime_mean
;
16 struct cfq_io_context
{
18 struct request_queue
*q
;
20 struct cfq_queue
*cfqq
[2];
22 struct io_context
*ioc
;
24 struct cfq_ttime ttime
;
26 struct list_head queue_list
;
27 struct hlist_node cic_list
;
29 void (*dtor
)(struct io_context
*); /* destructor */
30 void (*exit
)(struct io_context
*); /* called on task exit */
32 struct rcu_head rcu_head
;
36 * I/O subsystem state of the associated processes. It is refcounted
37 * and kmalloc'ed. These could be shared between processes.
40 atomic_long_t refcount
;
43 /* all the fields below are protected by this lock */
46 unsigned short ioprio
;
47 unsigned short ioprio_changed
;
49 #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
50 unsigned short cgroup_changed
;
54 * For request batching
56 int nr_batch_requests
; /* Number of requests left in the batch */
57 unsigned long last_waited
; /* Time last woken after wait for request */
59 struct radix_tree_root radix_root
;
60 struct hlist_head cic_list
;
64 static inline struct io_context
*ioc_task_link(struct io_context
*ioc
)
67 * if ref count is zero, don't allow sharing (ioc is going away, it's
70 if (ioc
&& atomic_long_inc_not_zero(&ioc
->refcount
)) {
71 atomic_inc(&ioc
->nr_tasks
);
80 void put_io_context(struct io_context
*ioc
);
81 void exit_io_context(struct task_struct
*task
);
82 struct io_context
*get_task_io_context(struct task_struct
*task
,
83 gfp_t gfp_flags
, int node
);
86 static inline void put_io_context(struct io_context
*ioc
) { }
87 static inline void exit_io_context(struct task_struct
*task
) { }