Blame view
include/linux/iocontext.h
1.93 KB
fd0928df9 ioprio: move io p... |
1 2 |
#ifndef IOCONTEXT_H #define IOCONTEXT_H |
4ac845a2e block: cfq: make ... |
3 |
#include <linux/radix-tree.h> |
34e6bbf23 cfq-iosched: fix ... |
4 |
#include <linux/rcupdate.h> |
4ac845a2e block: cfq: make ... |
5 |
|
fd0928df9 ioprio: move io p... |
6 7 |
struct cfq_queue; struct cfq_io_context { |
fd0928df9 ioprio: move io p... |
8 9 10 11 12 13 14 |
void *key; struct cfq_queue *cfqq[2]; struct io_context *ioc; unsigned long last_end_request; |
fd0928df9 ioprio: move io p... |
15 16 17 18 |
unsigned long ttime_total; unsigned long ttime_samples; unsigned long ttime_mean; |
fd0928df9 ioprio: move io p... |
19 |
struct list_head queue_list; |
ffc4e7595 cfq-iosched: add ... |
20 |
struct hlist_node cic_list; |
fd0928df9 ioprio: move io p... |
21 22 23 |
void (*dtor)(struct io_context *); /* destructor */ void (*exit)(struct io_context *); /* called on task exit */ |
34e6bbf23 cfq-iosched: fix ... |
24 25 |
struct rcu_head rcu_head; |
fd0928df9 ioprio: move io p... |
26 27 28 |
}; /* |
d38ecf935 io context sharin... |
29 30 |
* I/O subsystem state of the associated processes. It is refcounted * and kmalloc'ed. These could be shared between processes. |
fd0928df9 ioprio: move io p... |
31 32 |
*/ struct io_context { |
d9c7d394a block: prevent po... |
33 |
atomic_long_t refcount; |
d38ecf935 io context sharin... |
34 35 36 37 |
atomic_t nr_tasks; /* all the fields below are protected by this lock */ spinlock_t lock; |
fd0928df9 ioprio: move io p... |
38 39 40 |
unsigned short ioprio; unsigned short ioprio_changed; |
67523c48a cgroups: blkio su... |
41 |
#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) |
31e4c28d9 blkio: Introduce ... |
42 43 |
unsigned short cgroup_changed; #endif |
fd0928df9 ioprio: move io p... |
44 45 46 |
/* * For request batching */ |
fd0928df9 ioprio: move io p... |
47 |
int nr_batch_requests; /* Number of requests left in the batch */ |
58c24a616 block: remove pad... |
48 |
unsigned long last_waited; /* Time last woken after wait for request */ |
fd0928df9 ioprio: move io p... |
49 |
|
4ac845a2e block: cfq: make ... |
50 |
struct radix_tree_root radix_root; |
ffc4e7595 cfq-iosched: add ... |
51 |
struct hlist_head cic_list; |
4d2deb40b kernel: __rcu ann... |
52 |
void __rcu *ioc_data; |
fd0928df9 ioprio: move io p... |
53 |
}; |
d38ecf935 io context sharin... |
54 55 56 57 58 59 |
static inline struct io_context *ioc_task_link(struct io_context *ioc) { /* * if ref count is zero, don't allow sharing (ioc is going away, it's * a race). */ |
d9c7d394a block: prevent po... |
60 |
if (ioc && atomic_long_inc_not_zero(&ioc->refcount)) { |
cbb4f2646 io context: fix r... |
61 |
atomic_inc(&ioc->nr_tasks); |
d38ecf935 io context sharin... |
62 |
return ioc; |
d237e5c7c io context: incre... |
63 |
} |
d38ecf935 io context sharin... |
64 65 66 |
return NULL; } |
b69f22920 block: Fix io_con... |
67 |
struct task_struct; |
da9cbc873 block: blkdev.h c... |
68 69 |
#ifdef CONFIG_BLOCK int put_io_context(struct io_context *ioc); |
b69f22920 block: Fix io_con... |
70 |
void exit_io_context(struct task_struct *task); |
da9cbc873 block: blkdev.h c... |
71 72 |
struct io_context *get_io_context(gfp_t gfp_flags, int node); struct io_context *alloc_io_context(gfp_t gfp_flags, int node); |
da9cbc873 block: blkdev.h c... |
73 |
#else |
b69f22920 block: Fix io_con... |
74 |
static inline void exit_io_context(struct task_struct *task) |
da9cbc873 block: blkdev.h c... |
75 76 77 78 79 80 81 82 83 |
{ } struct io_context; static inline int put_io_context(struct io_context *ioc) { return 1; } #endif |
fd0928df9 ioprio: move io p... |
84 |
#endif |