aio: cleanup: flatten kill_ioctx()

There is no need to have most of the code in kill_ioctx() indented.  Flatten
it.

Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
This commit is contained in:
Benjamin LaHaise
2014-04-29 12:55:48 -04:00
parent fb2d448383
commit fa88b6f880

View File

@@ -730,39 +730,39 @@ err:
static int kill_ioctx(struct mm_struct *mm, struct kioctx *ctx, static int kill_ioctx(struct mm_struct *mm, struct kioctx *ctx,
struct completion *requests_done) struct completion *requests_done)
{ {
if (!atomic_xchg(&ctx->dead, 1)) { struct kioctx_table *table;
struct kioctx_table *table;
spin_lock(&mm->ioctx_lock); if (atomic_xchg(&ctx->dead, 1))
rcu_read_lock(); return -EINVAL;
table = rcu_dereference(mm->ioctx_table);
WARN_ON(ctx != table->table[ctx->id]);
table->table[ctx->id] = NULL;
rcu_read_unlock();
spin_unlock(&mm->ioctx_lock);
/* percpu_ref_kill() will do the necessary call_rcu() */ spin_lock(&mm->ioctx_lock);
wake_up_all(&ctx->wait); rcu_read_lock();
table = rcu_dereference(mm->ioctx_table);
/* WARN_ON(ctx != table->table[ctx->id]);
* It'd be more correct to do this in free_ioctx(), after all table->table[ctx->id] = NULL;
* the outstanding kiocbs have finished - but by then io_destroy rcu_read_unlock();
* has already returned, so io_setup() could potentially return spin_unlock(&mm->ioctx_lock);
* -EAGAIN with no ioctxs actually in use (as far as userspace
* could tell).
*/
aio_nr_sub(ctx->max_reqs);
if (ctx->mmap_size) /* percpu_ref_kill() will do the necessary call_rcu() */
vm_munmap(ctx->mmap_base, ctx->mmap_size); wake_up_all(&ctx->wait);
ctx->requests_done = requests_done; /*
percpu_ref_kill(&ctx->users); * It'd be more correct to do this in free_ioctx(), after all
return 0; * the outstanding kiocbs have finished - but by then io_destroy
} * has already returned, so io_setup() could potentially return
* -EAGAIN with no ioctxs actually in use (as far as userspace
* could tell).
*/
aio_nr_sub(ctx->max_reqs);
return -EINVAL; if (ctx->mmap_size)
vm_munmap(ctx->mmap_base, ctx->mmap_size);
ctx->requests_done = requests_done;
percpu_ref_kill(&ctx->users);
return 0;
} }
/* wait_on_sync_kiocb: /* wait_on_sync_kiocb: