aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/iocontext.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-01-24 02:52:45 -0500
committerJens Axboe <jens.axboe@oracle.com>2008-01-28 04:50:29 -0500
commitfd0928df98b9578be8a786ac0cb78a47a5e17a20 (patch)
tree70a34cf207bea1bec28e59cf0dba7d20e7f8b0f1 /include/linux/iocontext.h
parent91525300baf162e83e923b09ca286f9205e21522 (diff)
ioprio: move io priority from task_struct to io_context
This is where it belongs and then it doesn't take up space for a process that doesn't do IO. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux/iocontext.h')
-rw-r--r--include/linux/iocontext.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
new file mode 100644
index 000000000000..186807ea62e2
--- /dev/null
+++ b/include/linux/iocontext.h
@@ -0,0 +1,79 @@
1#ifndef IOCONTEXT_H
2#define IOCONTEXT_H
3
4/*
5 * This is the per-process anticipatory I/O scheduler state.
6 */
7struct as_io_context {
8 spinlock_t lock;
9
10 void (*dtor)(struct as_io_context *aic); /* destructor */
11 void (*exit)(struct as_io_context *aic); /* called on task exit */
12
13 unsigned long state;
14 atomic_t nr_queued; /* queued reads & sync writes */
15 atomic_t nr_dispatched; /* number of requests gone to the drivers */
16
17 /* IO History tracking */
18 /* Thinktime */
19 unsigned long last_end_request;
20 unsigned long ttime_total;
21 unsigned long ttime_samples;
22 unsigned long ttime_mean;
23 /* Layout pattern */
24 unsigned int seek_samples;
25 sector_t last_request_pos;
26 u64 seek_total;
27 sector_t seek_mean;
28};
29
30struct cfq_queue;
31struct cfq_io_context {
32 struct rb_node rb_node;
33 void *key;
34
35 struct cfq_queue *cfqq[2];
36
37 struct io_context *ioc;
38
39 unsigned long last_end_request;
40 sector_t last_request_pos;
41
42 unsigned long ttime_total;
43 unsigned long ttime_samples;
44 unsigned long ttime_mean;
45
46 unsigned int seek_samples;
47 u64 seek_total;
48 sector_t seek_mean;
49
50 struct list_head queue_list;
51
52 void (*dtor)(struct io_context *); /* destructor */
53 void (*exit)(struct io_context *); /* called on task exit */
54};
55
56/*
57 * This is the per-process I/O subsystem state. It is refcounted and
58 * kmalloc'ed. Currently all fields are modified in process io context
59 * (apart from the atomic refcount), so require no locking.
60 */
61struct io_context {
62 atomic_t refcount;
63 struct task_struct *task;
64
65 unsigned short ioprio;
66 unsigned short ioprio_changed;
67
68 /*
69 * For request batching
70 */
71 unsigned long last_waited; /* Time last woken after wait for request */
72 int nr_batch_requests; /* Number of requests left in the batch */
73
74 struct as_io_context *aic;
75 struct rb_root cic_root;
76 void *ioc_data;
77};
78
79#endif