Lines Matching refs:nr_events
120 unsigned nr_events; member
460 static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events) in aio_setup_ring() argument
470 nr_events += 2; /* 1 is required, 2 for good luck */ in aio_setup_ring()
473 size += sizeof(struct io_event) * nr_events; in aio_setup_ring()
486 nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring)) in aio_setup_ring()
541 ctx->nr_events = nr_events; /* trusted copy */ in aio_setup_ring()
544 ring->nr = nr_events; /* user copy */ in aio_setup_ring()
700 static struct kioctx *ioctx_alloc(unsigned nr_events) in ioctx_alloc() argument
710 unsigned int max_reqs = nr_events; in ioctx_alloc()
721 nr_events = max(nr_events, num_possible_cpus() * 4); in ioctx_alloc()
722 nr_events *= 2; in ioctx_alloc()
725 if (nr_events > (0x10000000U / sizeof(struct io_event))) { in ioctx_alloc()
730 if (!nr_events || (unsigned long)max_reqs > aio_max_nr) in ioctx_alloc()
759 err = aio_setup_ring(ctx, nr_events); in ioctx_alloc()
763 atomic_set(&ctx->reqs_available, ctx->nr_events - 1); in ioctx_alloc()
764 ctx->req_batch = (ctx->nr_events - 1) / (num_possible_cpus() * 4); in ioctx_alloc()
790 ctx, ctx->user_id, mm, ctx->nr_events); in ioctx_alloc()
961 head %= ctx->nr_events; in refill_reqs_available()
965 events_in_ring = ctx->nr_events - (head - tail); in refill_reqs_available()
1105 if (++tail >= ctx->nr_events) in aio_complete()
1201 pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events); in aio_read_events_ring()
1206 head %= ctx->nr_events; in aio_read_events_ring()
1207 tail %= ctx->nr_events; in aio_read_events_ring()
1214 avail = (head <= tail ? tail : ctx->nr_events) - head; in aio_read_events_ring()
1237 head %= ctx->nr_events; in aio_read_events_ring()
1311 SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp) in SYSCALL_DEFINE2() argument
1322 if (unlikely(ctx || nr_events == 0)) { in SYSCALL_DEFINE2()
1324 ctx, nr_events); in SYSCALL_DEFINE2()
1328 ioctx = ioctx_alloc(nr_events); in SYSCALL_DEFINE2()
1342 COMPAT_SYSCALL_DEFINE2(io_setup, unsigned, nr_events, u32 __user *, ctx32p) in COMPAT_SYSCALL_DEFINE2() argument
1353 if (unlikely(ctx || nr_events == 0)) { in COMPAT_SYSCALL_DEFINE2()
1355 ctx, nr_events); in COMPAT_SYSCALL_DEFINE2()
1359 ioctx = ioctx_alloc(nr_events); in COMPAT_SYSCALL_DEFINE2()
2043 if (nr > ctx->nr_events) in SYSCALL_DEFINE3()
2044 nr = ctx->nr_events; in SYSCALL_DEFINE3()
2085 if (nr > ctx->nr_events) in COMPAT_SYSCALL_DEFINE3()
2086 nr = ctx->nr_events; in COMPAT_SYSCALL_DEFINE3()