diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-01-24 02:52:45 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-01-28 04:50:29 -0500 |
commit | fd0928df98b9578be8a786ac0cb78a47a5e17a20 (patch) | |
tree | 70a34cf207bea1bec28e59cf0dba7d20e7f8b0f1 /include/linux/blkdev.h | |
parent | 91525300baf162e83e923b09ca286f9205e21522 (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/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 81 |
1 files changed, 7 insertions, 74 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 49b7a4c31a6d..510a18ba1ec5 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -34,83 +34,10 @@ struct sg_io_hdr; | |||
34 | #define BLKDEV_MIN_RQ 4 | 34 | #define BLKDEV_MIN_RQ 4 |
35 | #define BLKDEV_MAX_RQ 128 /* Default maximum */ | 35 | #define BLKDEV_MAX_RQ 128 /* Default maximum */ |
36 | 36 | ||
37 | /* | ||
38 | * This is the per-process anticipatory I/O scheduler state. | ||
39 | */ | ||
40 | struct as_io_context { | ||
41 | spinlock_t lock; | ||
42 | |||
43 | void (*dtor)(struct as_io_context *aic); /* destructor */ | ||
44 | void (*exit)(struct as_io_context *aic); /* called on task exit */ | ||
45 | |||
46 | unsigned long state; | ||
47 | atomic_t nr_queued; /* queued reads & sync writes */ | ||
48 | atomic_t nr_dispatched; /* number of requests gone to the drivers */ | ||
49 | |||
50 | /* IO History tracking */ | ||
51 | /* Thinktime */ | ||
52 | unsigned long last_end_request; | ||
53 | unsigned long ttime_total; | ||
54 | unsigned long ttime_samples; | ||
55 | unsigned long ttime_mean; | ||
56 | /* Layout pattern */ | ||
57 | unsigned int seek_samples; | ||
58 | sector_t last_request_pos; | ||
59 | u64 seek_total; | ||
60 | sector_t seek_mean; | ||
61 | }; | ||
62 | |||
63 | struct cfq_queue; | ||
64 | struct cfq_io_context { | ||
65 | struct rb_node rb_node; | ||
66 | void *key; | ||
67 | |||
68 | struct cfq_queue *cfqq[2]; | ||
69 | |||
70 | struct io_context *ioc; | ||
71 | |||
72 | unsigned long last_end_request; | ||
73 | sector_t last_request_pos; | ||
74 | |||
75 | unsigned long ttime_total; | ||
76 | unsigned long ttime_samples; | ||
77 | unsigned long ttime_mean; | ||
78 | |||
79 | unsigned int seek_samples; | ||
80 | u64 seek_total; | ||
81 | sector_t seek_mean; | ||
82 | |||
83 | struct list_head queue_list; | ||
84 | |||
85 | void (*dtor)(struct io_context *); /* destructor */ | ||
86 | void (*exit)(struct io_context *); /* called on task exit */ | ||
87 | }; | ||
88 | |||
89 | /* | ||
90 | * This is the per-process I/O subsystem state. It is refcounted and | ||
91 | * kmalloc'ed. Currently all fields are modified in process io context | ||
92 | * (apart from the atomic refcount), so require no locking. | ||
93 | */ | ||
94 | struct io_context { | ||
95 | atomic_t refcount; | ||
96 | struct task_struct *task; | ||
97 | |||
98 | unsigned int ioprio_changed; | ||
99 | |||
100 | /* | ||
101 | * For request batching | ||
102 | */ | ||
103 | unsigned long last_waited; /* Time last woken after wait for request */ | ||
104 | int nr_batch_requests; /* Number of requests left in the batch */ | ||
105 | |||
106 | struct as_io_context *aic; | ||
107 | struct rb_root cic_root; | ||
108 | void *ioc_data; | ||
109 | }; | ||
110 | |||
111 | void put_io_context(struct io_context *ioc); | 37 | void put_io_context(struct io_context *ioc); |
112 | void exit_io_context(void); | 38 | void exit_io_context(void); |
113 | struct io_context *get_io_context(gfp_t gfp_flags, int node); | 39 | struct io_context *get_io_context(gfp_t gfp_flags, int node); |
40 | struct io_context *alloc_io_context(gfp_t gfp_flags, int node); | ||
114 | void copy_io_context(struct io_context **pdst, struct io_context **psrc); | 41 | void copy_io_context(struct io_context **pdst, struct io_context **psrc); |
115 | void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); | 42 | void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); |
116 | 43 | ||
@@ -894,6 +821,12 @@ static inline void exit_io_context(void) | |||
894 | { | 821 | { |
895 | } | 822 | } |
896 | 823 | ||
824 | static inline int put_io_context(struct io_context *ioc) | ||
825 | { | ||
826 | return 1; | ||
827 | } | ||
828 | |||
829 | |||
897 | #endif /* CONFIG_BLOCK */ | 830 | #endif /* CONFIG_BLOCK */ |
898 | 831 | ||
899 | #endif | 832 | #endif |