4 #include <linux/radix-tree.h>
5 #include <linux/rcupdate.h>
8 struct cfq_io_context
{
10 unsigned long dead_key
;
12 struct cfq_queue
*cfqq
[2];
14 struct io_context
*ioc
;
16 unsigned long last_end_request
;
18 unsigned long ttime_total
;
19 unsigned long ttime_samples
;
20 unsigned long ttime_mean
;
22 struct list_head queue_list
;
23 struct hlist_node cic_list
;
25 void (*dtor
)(struct io_context
*); /* destructor */
26 void (*exit
)(struct io_context
*); /* called on task exit */
28 struct rcu_head rcu_head
;
32 * I/O subsystem state of the associated processes. It is refcounted
33 * and kmalloc'ed. These could be shared between processes.
36 atomic_long_t refcount
;
39 /* all the fields below are protected by this lock */
42 unsigned short ioprio
;
43 unsigned short ioprio_changed
;
45 #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
46 unsigned short cgroup_changed
;
50 * For request batching
52 int nr_batch_requests
; /* Number of requests left in the batch */
53 unsigned long last_waited
; /* Time last woken after wait for request */
55 struct radix_tree_root radix_root
;
56 struct hlist_head cic_list
;
60 static inline struct io_context
*ioc_task_link(struct io_context
*ioc
)
63 * if ref count is zero, don't allow sharing (ioc is going away, it's
66 if (ioc
&& atomic_long_inc_not_zero(&ioc
->refcount
)) {
67 atomic_inc(&ioc
->nr_tasks
);
76 int put_io_context(struct io_context
*ioc
);
77 void exit_io_context(struct task_struct
*task
);
78 struct io_context
*get_io_context(gfp_t gfp_flags
, int node
);
79 struct io_context
*alloc_io_context(gfp_t gfp_flags
, int node
);
80 void copy_io_context(struct io_context
**pdst
, struct io_context
**psrc
);
82 static inline void exit_io_context(struct task_struct
*task
)
87 static inline int put_io_context(struct io_context
*ioc
)