Lines Matching defs:nr_events
114 * The real limit is nr_events - 1, which will be larger (see
120 unsigned nr_events;
491 static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events)
501 nr_events += 2; /* 1 is required, 2 for good luck */
504 size += sizeof(struct io_event) * nr_events;
517 nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring))
572 ctx->nr_events = nr_events; /* trusted copy */
575 ring->nr = nr_events; /* user copy */
736 static struct kioctx *ioctx_alloc(unsigned nr_events)
743 * Store the original nr_events -- what userspace passed to io_setup(),
746 unsigned int max_reqs = nr_events;
753 * and unavailable, double nr_events so userspace sees what they
757 nr_events = max(nr_events, num_possible_cpus() * 4);
758 nr_events *= 2;
761 if (nr_events > (0x10000000U / sizeof(struct io_event))) {
762 pr_debug("ENOMEM: nr_events too high\n");
766 if (!nr_events || (unsigned long)max_reqs > aio_max_nr)
795 err = aio_setup_ring(ctx, nr_events);
799 atomic_set(&ctx->reqs_available, ctx->nr_events - 1);
800 ctx->req_batch = (ctx->nr_events - 1) / (num_possible_cpus() * 4);
826 ctx, ctx->user_id, mm, ctx->nr_events);
994 head %= ctx->nr_events;
998 events_in_ring = ctx->nr_events - (head - tail);
1137 if (++tail >= ctx->nr_events)
1230 pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events);
1235 head %= ctx->nr_events;
1236 tail %= ctx->nr_events;
1243 avail = (head <= tail ? tail : ctx->nr_events) - head;
1265 head %= ctx->nr_events;
1326 * Create an aio_context capable of receiving at least nr_events.
1331 * if the specified nr_events exceeds internal limits. May fail
1332 * with -EAGAIN if the specified nr_events exceeds the user's limit
1338 SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp)
1349 if (unlikely(ctx || nr_events == 0)) {
1350 pr_debug("EINVAL: ctx %lu nr_events %u\n",
1351 ctx, nr_events);
1355 ioctx = ioctx_alloc(nr_events);
1369 COMPAT_SYSCALL_DEFINE2(io_setup, unsigned, nr_events, u32 __user *, ctx32p)
1380 if (unlikely(ctx || nr_events == 0)) {
1381 pr_debug("EINVAL: ctx %lu nr_events %u\n",
1382 ctx, nr_events);
1386 ioctx = ioctx_alloc(nr_events);
2054 if (nr > ctx->nr_events)
2055 nr = ctx->nr_events;
2096 if (nr > ctx->nr_events)
2097 nr = ctx->nr_events;