aboutsummaryrefslogtreecommitdiff
path: root/block/ll_rw_blk.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-01-24 08:52:45 +0100
committerJens Axboe <jens.axboe@oracle.com>2008-01-28 10:50:29 +0100
commitfd0928df98b9578be8a786ac0cb78a47a5e17a20 (patch)
tree70a34cf207bea1bec28e59cf0dba7d20e7f8b0f1 /block/ll_rw_blk.c
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 'block/ll_rw_blk.c')
-rw-r--r--block/ll_rw_blk.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 3d0422f4845..b9bb02e845c 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3904,6 +3904,26 @@ void exit_io_context(void)
put_io_context(ioc);
}
+struct io_context *alloc_io_context(gfp_t gfp_flags, int node)
+{
+ struct io_context *ret;
+
+ ret = kmem_cache_alloc_node(iocontext_cachep, gfp_flags, node);
+ if (ret) {
+ atomic_set(&ret->refcount, 1);
+ ret->task = current;
+ ret->ioprio_changed = 0;
+ ret->ioprio = 0;
+ ret->last_waited = jiffies; /* doesn't matter... */
+ ret->nr_batch_requests = 0; /* because this is 0 */
+ ret->aic = NULL;
+ ret->cic_root.rb_node = NULL;
+ ret->ioc_data = NULL;
+ }
+
+ return ret;
+}
+
/*
* If the current task has no IO context then create one and initialise it.
* Otherwise, return its existing IO context.
@@ -3921,16 +3941,8 @@ static struct io_context *current_io_context(gfp_t gfp_flags, int node)
if (likely(ret))
return ret;
- ret = kmem_cache_alloc_node(iocontext_cachep, gfp_flags, node);
+ ret = alloc_io_context(gfp_flags, node);
if (ret) {
- atomic_set(&ret->refcount, 1);
- ret->task = current;
- ret->ioprio_changed = 0;
- ret->last_waited = jiffies; /* doesn't matter... */
- ret->nr_batch_requests = 0; /* because this is 0 */
- ret->aic = NULL;
- ret->cic_root.rb_node = NULL;
- ret->ioc_data = NULL;
/* make sure set_task_ioprio() sees the settings above */
smp_wmb();
tsk->io_context = ret;