diff options
Diffstat (limited to 'block/blk-ioc.c')
-rw-r--r-- | block/blk-ioc.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/block/blk-ioc.c b/block/blk-ioc.c index d4ed6000147d..d22c4c55c406 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/bio.h> | 7 | #include <linux/bio.h> |
8 | #include <linux/blkdev.h> | 8 | #include <linux/blkdev.h> |
9 | #include <linux/bootmem.h> /* for max_pfn/max_low_pfn */ | 9 | #include <linux/bootmem.h> /* for max_pfn/max_low_pfn */ |
10 | #include <linux/slab.h> | ||
10 | 11 | ||
11 | #include "blk.h" | 12 | #include "blk.h" |
12 | 13 | ||
@@ -39,8 +40,6 @@ int put_io_context(struct io_context *ioc) | |||
39 | 40 | ||
40 | if (atomic_long_dec_and_test(&ioc->refcount)) { | 41 | if (atomic_long_dec_and_test(&ioc->refcount)) { |
41 | rcu_read_lock(); | 42 | rcu_read_lock(); |
42 | if (ioc->aic && ioc->aic->dtor) | ||
43 | ioc->aic->dtor(ioc->aic); | ||
44 | cfq_dtor(ioc); | 43 | cfq_dtor(ioc); |
45 | rcu_read_unlock(); | 44 | rcu_read_unlock(); |
46 | 45 | ||
@@ -66,22 +65,20 @@ static void cfq_exit(struct io_context *ioc) | |||
66 | } | 65 | } |
67 | 66 | ||
68 | /* Called by the exitting task */ | 67 | /* Called by the exitting task */ |
69 | void exit_io_context(void) | 68 | void exit_io_context(struct task_struct *task) |
70 | { | 69 | { |
71 | struct io_context *ioc; | 70 | struct io_context *ioc; |
72 | 71 | ||
73 | task_lock(current); | 72 | task_lock(task); |
74 | ioc = current->io_context; | 73 | ioc = task->io_context; |
75 | current->io_context = NULL; | 74 | task->io_context = NULL; |
76 | task_unlock(current); | 75 | task_unlock(task); |
77 | 76 | ||
78 | if (atomic_dec_and_test(&ioc->nr_tasks)) { | 77 | if (atomic_dec_and_test(&ioc->nr_tasks)) { |
79 | if (ioc->aic && ioc->aic->exit) | ||
80 | ioc->aic->exit(ioc->aic); | ||
81 | cfq_exit(ioc); | 78 | cfq_exit(ioc); |
82 | 79 | ||
83 | put_io_context(ioc); | ||
84 | } | 80 | } |
81 | put_io_context(ioc); | ||
85 | } | 82 | } |
86 | 83 | ||
87 | struct io_context *alloc_io_context(gfp_t gfp_flags, int node) | 84 | struct io_context *alloc_io_context(gfp_t gfp_flags, int node) |
@@ -95,9 +92,8 @@ struct io_context *alloc_io_context(gfp_t gfp_flags, int node) | |||
95 | spin_lock_init(&ret->lock); | 92 | spin_lock_init(&ret->lock); |
96 | ret->ioprio_changed = 0; | 93 | ret->ioprio_changed = 0; |
97 | ret->ioprio = 0; | 94 | ret->ioprio = 0; |
98 | ret->last_waited = jiffies; /* doesn't matter... */ | 95 | ret->last_waited = 0; /* doesn't matter... */ |
99 | ret->nr_batch_requests = 0; /* because this is 0 */ | 96 | ret->nr_batch_requests = 0; /* because this is 0 */ |
100 | ret->aic = NULL; | ||
101 | INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH); | 97 | INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH); |
102 | INIT_HLIST_HEAD(&ret->cic_list); | 98 | INIT_HLIST_HEAD(&ret->cic_list); |
103 | ret->ioc_data = NULL; | 99 | ret->ioc_data = NULL; |