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
{
19 struct cfq_queue
*cfqq
[2];
21 struct io_context
*ioc
;
23 struct cfq_ttime ttime
;
25 struct list_head queue_list
;
26 struct hlist_node cic_list
;
28 void (*dtor
)(struct io_context
*); /* destructor */
29 void (*exit
)(struct io_context
*); /* called on task exit */
31 struct rcu_head rcu_head
;
35 * I/O subsystem state of the associated processes. It is refcounted
36 * and kmalloc'ed. These could be shared between processes.
39 atomic_long_t refcount
;
42 /* all the fields below are protected by this lock */
45 unsigned short ioprio
;
46 unsigned short ioprio_changed
;
48 #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
49 unsigned short cgroup_changed
;
53 * For request batching
55 int nr_batch_requests
; /* Number of requests left in the batch */
56 unsigned long last_waited
; /* Time last woken after wait for request */
58 struct radix_tree_root radix_root
;
59 struct hlist_head cic_list
;
63 static inline struct io_context
*ioc_task_link(struct io_context
*ioc
)
66 * if ref count is zero, don't allow sharing (ioc is going away, it's
69 if (ioc
&& atomic_long_inc_not_zero(&ioc
->refcount
)) {
70 atomic_inc(&ioc
->nr_tasks
);
79 int put_io_context(struct io_context
*ioc
);
80 void exit_io_context(struct task_struct
*task
);
81 struct io_context
*get_io_context(gfp_t gfp_flags
, int node
);
82 struct io_context
*alloc_io_context(gfp_t gfp_flags
, int node
);
84 static inline void exit_io_context(struct task_struct
*task
)
89 static inline int put_io_context(struct io_context
*ioc
)