Lines Matching refs:nr_events
114 unsigned nr_events; member
445 static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events) in aio_setup_ring() argument
455 nr_events += 2; /* 1 is required, 2 for good luck */ in aio_setup_ring()
458 size += sizeof(struct io_event) * nr_events; in aio_setup_ring()
471 nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring)) in aio_setup_ring()
526 ctx->nr_events = nr_events; /* trusted copy */ in aio_setup_ring()
529 ring->nr = nr_events; /* user copy */ in aio_setup_ring()
686 static struct kioctx *ioctx_alloc(unsigned nr_events) in ioctx_alloc() argument
696 unsigned int max_reqs = nr_events; in ioctx_alloc()
707 nr_events = max(nr_events, num_possible_cpus() * 4); in ioctx_alloc()
708 nr_events *= 2; in ioctx_alloc()
711 if (nr_events > (0x10000000U / sizeof(struct io_event))) { in ioctx_alloc()
716 if (!nr_events || (unsigned long)max_reqs > aio_max_nr) in ioctx_alloc()
745 err = aio_setup_ring(ctx, nr_events); in ioctx_alloc()
749 atomic_set(&ctx->reqs_available, ctx->nr_events - 1); in ioctx_alloc()
750 ctx->req_batch = (ctx->nr_events - 1) / (num_possible_cpus() * 4); in ioctx_alloc()
776 ctx, ctx->user_id, mm, ctx->nr_events); in ioctx_alloc()
947 head %= ctx->nr_events; in refill_reqs_available()
951 events_in_ring = ctx->nr_events - (head - tail); in refill_reqs_available()
1081 if (++tail >= ctx->nr_events) in aio_complete()
1175 pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events); in aio_read_events_ring()
1180 head %= ctx->nr_events; in aio_read_events_ring()
1181 tail %= ctx->nr_events; in aio_read_events_ring()
1188 avail = (head <= tail ? tail : ctx->nr_events) - head; in aio_read_events_ring()
1211 head %= ctx->nr_events; in aio_read_events_ring()
1285 SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp) in SYSCALL_DEFINE2() argument
1296 if (unlikely(ctx || nr_events == 0)) { in SYSCALL_DEFINE2()
1298 ctx, nr_events); in SYSCALL_DEFINE2()
1302 ioctx = ioctx_alloc(nr_events); in SYSCALL_DEFINE2()
1316 COMPAT_SYSCALL_DEFINE2(io_setup, unsigned, nr_events, u32 __user *, ctx32p) in COMPAT_SYSCALL_DEFINE2() argument
1327 if (unlikely(ctx || nr_events == 0)) { in COMPAT_SYSCALL_DEFINE2()
1329 ctx, nr_events); in COMPAT_SYSCALL_DEFINE2()
1333 ioctx = ioctx_alloc(nr_events); in COMPAT_SYSCALL_DEFINE2()
1904 if (nr > ctx->nr_events) in SYSCALL_DEFINE3()
1905 nr = ctx->nr_events; in SYSCALL_DEFINE3()
1944 if (nr > ctx->nr_events) in COMPAT_SYSCALL_DEFINE3()
1945 nr = ctx->nr_events; in COMPAT_SYSCALL_DEFINE3()