Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: pass sq entries in the params struct

There is no need to pass the user requested number of SQ entries
separately from the main parameter structure io_uring_params. Initialise
it at the beginning and stop passing it in favour of struct
io_uring_params::sq_entries.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Pavel Begunkov and committed by
Jens Axboe
7bb21a52 4aed5b4e

+9 -6
+7 -4
io_uring/io_uring.c
··· 3479 3479 return 0; 3480 3480 } 3481 3481 3482 - int io_uring_fill_params(unsigned entries, struct io_uring_params *p) 3482 + int io_uring_fill_params(struct io_uring_params *p) 3483 3483 { 3484 + unsigned entries = p->sq_entries; 3485 + 3484 3486 if (!entries) 3485 3487 return -EINVAL; 3486 3488 if (entries > IORING_MAX_ENTRIES) { ··· 3544 3542 return 0; 3545 3543 } 3546 3544 3547 - static __cold int io_uring_create(unsigned entries, struct io_uring_params *p, 3545 + static __cold int io_uring_create(struct io_uring_params *p, 3548 3546 struct io_uring_params __user *params) 3549 3547 { 3550 3548 struct io_ring_ctx *ctx; ··· 3556 3554 if (ret) 3557 3555 return ret; 3558 3556 3559 - ret = io_uring_fill_params(entries, p); 3557 + ret = io_uring_fill_params(p); 3560 3558 if (unlikely(ret)) 3561 3559 return ret; 3562 3560 ··· 3695 3693 3696 3694 if (p.flags & ~IORING_SETUP_FLAGS) 3697 3695 return -EINVAL; 3698 - return io_uring_create(entries, &p, params); 3696 + p.sq_entries = entries; 3697 + return io_uring_create(&p, params); 3699 3698 } 3700 3699 3701 3700 static inline int io_uring_allowed(void)
+1 -1
io_uring/io_uring.h
··· 136 136 137 137 unsigned long rings_size(unsigned int flags, unsigned int sq_entries, 138 138 unsigned int cq_entries, size_t *sq_offset); 139 - int io_uring_fill_params(unsigned entries, struct io_uring_params *p); 139 + int io_uring_fill_params(struct io_uring_params *p); 140 140 bool io_cqe_cache_refill(struct io_ring_ctx *ctx, bool overflow, bool cqe32); 141 141 int io_run_task_work_sig(struct io_ring_ctx *ctx); 142 142 int io_run_local_work(struct io_ring_ctx *ctx, int min_events, int max_events);
+1 -1
io_uring/register.c
··· 416 416 /* properties that are always inherited */ 417 417 p.flags |= (ctx->flags & COPY_FLAGS); 418 418 419 - ret = io_uring_fill_params(p.sq_entries, &p); 419 + ret = io_uring_fill_params(&p); 420 420 if (unlikely(ret)) 421 421 return ret; 422 422