aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-03-05 16:15:25 -0500
committerJens Axboe <axboe@kernel.dk>2012-03-06 15:27:24 -0500
commit3d48749d93a3dce732dd30a14002ab90ec4355f3 (patch)
tree50ce414ec87e590493476cf644092439c5f337fd /include/linux
parent24acfc34fba0b4f62ef9d5c2616eb0faa802b606 (diff)
block: ioc_task_link() can't fail
ioc_task_link() is used to share %current's ioc on clone. If %current->io_context is set, %current is guaranteed to have refcount on the ioc and, thus, ioc_task_link() can't fail. Replace error checking in ioc_task_link() with WARN_ON_ONCE() and make it just increment refcount and nr_tasks. -v2: Description typo fix (Vivek). Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/iocontext.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 1a301806303..81a8870ac22 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -120,18 +120,12 @@ struct io_context {
120 struct work_struct release_work; 120 struct work_struct release_work;
121}; 121};
122 122
123static inline struct io_context *ioc_task_link(struct io_context *ioc) 123static inline void ioc_task_link(struct io_context *ioc)
124{ 124{
125 /* 125 WARN_ON_ONCE(atomic_long_read(&ioc->refcount) <= 0);
126 * if ref count is zero, don't allow sharing (ioc is going away, it's 126 WARN_ON_ONCE(atomic_read(&ioc->nr_tasks) <= 0);
127 * a race). 127 atomic_long_inc(&ioc->refcount);
128 */ 128 atomic_inc(&ioc->nr_tasks);
129 if (ioc && atomic_long_inc_not_zero(&ioc->refcount)) {
130 atomic_inc(&ioc->nr_tasks);
131 return ioc;
132 }
133
134 return NULL;
135} 129}
136 130
137struct task_struct; 131struct task_struct;