aio.c (e10a4437cb37c85f2df95432025b392d98aac2aa) aio.c (c376222960ae91d5ffb9197ee36771aaed1d9f90)
1/*
2 * An async IO implementation for Linux
3 * Written by Benjamin LaHaise <bcrl@kvack.org>
4 *
5 * Implements an efficient asynchronous io interface.
6 *
7 * Copyright 2000, 2001, 2002 Red Hat, Inc. All Rights Reserved.
8 *

--- 197 unchanged lines hidden (view full) ---

206 (nr_events > (0x10000000U / sizeof(struct kiocb)))) {
207 pr_debug("ENOMEM: nr_events too high\n");
208 return ERR_PTR(-EINVAL);
209 }
210
211 if ((unsigned long)nr_events > aio_max_nr)
212 return ERR_PTR(-EAGAIN);
213
1/*
2 * An async IO implementation for Linux
3 * Written by Benjamin LaHaise <bcrl@kvack.org>
4 *
5 * Implements an efficient asynchronous io interface.
6 *
7 * Copyright 2000, 2001, 2002 Red Hat, Inc. All Rights Reserved.
8 *

--- 197 unchanged lines hidden (view full) ---

206 (nr_events > (0x10000000U / sizeof(struct kiocb)))) {
207 pr_debug("ENOMEM: nr_events too high\n");
208 return ERR_PTR(-EINVAL);
209 }
210
211 if ((unsigned long)nr_events > aio_max_nr)
212 return ERR_PTR(-EAGAIN);
213
214 ctx = kmem_cache_alloc(kioctx_cachep, GFP_KERNEL);
214 ctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL);
215 if (!ctx)
216 return ERR_PTR(-ENOMEM);
217
215 if (!ctx)
216 return ERR_PTR(-ENOMEM);
217
218 memset(ctx, 0, sizeof(*ctx));
219 ctx->max_reqs = nr_events;
220 mm = ctx->mm = current->mm;
221 atomic_inc(&mm->mm_count);
222
223 atomic_set(&ctx->users, 1);
224 spin_lock_init(&ctx->ctx_lock);
225 spin_lock_init(&ctx->ring_info.ring_lock);
226 init_waitqueue_head(&ctx->wait);

--- 1544 unchanged lines hidden ---
218 ctx->max_reqs = nr_events;
219 mm = ctx->mm = current->mm;
220 atomic_inc(&mm->mm_count);
221
222 atomic_set(&ctx->users, 1);
223 spin_lock_init(&ctx->ctx_lock);
224 spin_lock_init(&ctx->ring_info.ring_lock);
225 init_waitqueue_head(&ctx->wait);

--- 1544 unchanged lines hidden ---