diff options
| author | Andrew Morton <akpm@osdl.org> | 2003-07-04 19:37:19 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-07-04 19:37:19 -0700 |
| commit | 16f88dbdbffa3dc52b959706e6a311a932b51ed6 (patch) | |
| tree | 388bc4d9ad1e53f456d830fc8b5ac6145b7b51e6 /include/linux/blkdev.h | |
| parent | 80af89ca709d4dfe41178abe29217a0fefa1af12 (diff) | |
[PATCH] generic io contexts
From: Nick Piggin <piggin@cyberone.com.au>
Generalise the AS-specific per-process IO context so that other IO schedulers
could use it.
Diffstat (limited to 'include/linux/blkdev.h')
| -rw-r--r-- | include/linux/blkdev.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index d3a8f6ecd806..13116a7a7969 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -24,6 +24,50 @@ struct request_pm_state; #define BLKDEV_MIN_RQ 4 #define BLKDEV_MAX_RQ 128 /* Default maximum */ +/* + * This is the per-process anticipatory I/O scheduler state. + */ +struct as_io_context { + spinlock_t lock; + + void (*dtor)(struct as_io_context *aic); /* destructor */ + void (*exit)(struct as_io_context *aic); /* called on task exit */ + + unsigned long state; + atomic_t nr_queued; /* queued reads & sync writes */ + atomic_t nr_dispatched; /* number of requests gone to the drivers */ + + /* IO History tracking */ + /* Thinktime */ + unsigned long last_end_request; + unsigned long ttime_total; + unsigned long ttime_samples; + unsigned long ttime_mean; + /* Layout pattern */ + long seek_samples; + sector_t last_request_pos; + sector_t seek_total; + sector_t seek_mean; +}; + +/* + * This is the per-process I/O subsystem state. It is refcounted and + * kmalloc'ed. Currently all fields are modified in process io context + * (apart from the atomic refcount), so require no locking. + */ +struct io_context { + atomic_t refcount; + pid_t pid; + + struct as_io_context *aic; +}; + +void put_io_context(struct io_context *ioc); +void exit_io_context(void); +struct io_context *get_io_context(void); +void copy_io_context(struct io_context **pdst, struct io_context **psrc); +void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); + struct request_list { int count[2]; mempool_t *rq_pool; |
