Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309222
b: refs/heads/master
c: 3d48749
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Mar 6, 2012
1 parent 05f02e8 commit 9f240cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 24acfc34fba0b4f62ef9d5c2616eb0faa802b606
refs/heads/master: 3d48749d93a3dce732dd30a14002ab90ec4355f3
16 changes: 5 additions & 11 deletions trunk/include/linux/iocontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,12 @@ struct io_context {
struct work_struct release_work;
};

static inline struct io_context *ioc_task_link(struct io_context *ioc)
static inline void ioc_task_link(struct io_context *ioc)
{
/*
* if ref count is zero, don't allow sharing (ioc is going away, it's
* a race).
*/
if (ioc && atomic_long_inc_not_zero(&ioc->refcount)) {
atomic_inc(&ioc->nr_tasks);
return ioc;
}

return NULL;
WARN_ON_ONCE(atomic_long_read(&ioc->refcount) <= 0);
WARN_ON_ONCE(atomic_read(&ioc->nr_tasks) <= 0);
atomic_long_inc(&ioc->refcount);
atomic_inc(&ioc->nr_tasks);
}

struct task_struct;
Expand Down
5 changes: 2 additions & 3 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,9 +901,8 @@ static int copy_io(unsigned long clone_flags, struct task_struct *tsk)
* Share io context with parent, if CLONE_IO is set
*/
if (clone_flags & CLONE_IO) {
tsk->io_context = ioc_task_link(ioc);
if (unlikely(!tsk->io_context))
return -ENOMEM;
ioc_task_link(ioc);
tsk->io_context = ioc;
} else if (ioprio_valid(ioc->ioprio)) {
new_ioc = get_task_io_context(tsk, GFP_KERNEL, NUMA_NO_NODE);
if (unlikely(!new_ioc))
Expand Down

0 comments on commit 9f240cf

Please sign in to comment.