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>pull/1354/merge
parent
4aed5b4e6d
commit
7bb21a52e2
|
|
@ -3479,8 +3479,10 @@ static int io_uring_sanitise_params(struct io_uring_params *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int io_uring_fill_params(unsigned entries, struct io_uring_params *p)
|
||||
int io_uring_fill_params(struct io_uring_params *p)
|
||||
{
|
||||
unsigned entries = p->sq_entries;
|
||||
|
||||
if (!entries)
|
||||
return -EINVAL;
|
||||
if (entries > IORING_MAX_ENTRIES) {
|
||||
|
|
@ -3542,7 +3544,7 @@ int io_uring_fill_params(unsigned entries, struct io_uring_params *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
|
||||
static __cold int io_uring_create(struct io_uring_params *p,
|
||||
struct io_uring_params __user *params)
|
||||
{
|
||||
struct io_ring_ctx *ctx;
|
||||
|
|
@ -3554,7 +3556,7 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = io_uring_fill_params(entries, p);
|
||||
ret = io_uring_fill_params(p);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
|
|
@ -3693,7 +3695,8 @@ static long io_uring_setup(u32 entries, struct io_uring_params __user *params)
|
|||
|
||||
if (p.flags & ~IORING_SETUP_FLAGS)
|
||||
return -EINVAL;
|
||||
return io_uring_create(entries, &p, params);
|
||||
p.sq_entries = entries;
|
||||
return io_uring_create(&p, params);
|
||||
}
|
||||
|
||||
static inline int io_uring_allowed(void)
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ static inline bool io_should_wake(struct io_wait_queue *iowq)
|
|||
|
||||
unsigned long rings_size(unsigned int flags, unsigned int sq_entries,
|
||||
unsigned int cq_entries, size_t *sq_offset);
|
||||
int io_uring_fill_params(unsigned entries, struct io_uring_params *p);
|
||||
int io_uring_fill_params(struct io_uring_params *p);
|
||||
bool io_cqe_cache_refill(struct io_ring_ctx *ctx, bool overflow, bool cqe32);
|
||||
int io_run_task_work_sig(struct io_ring_ctx *ctx);
|
||||
int io_run_local_work(struct io_ring_ctx *ctx, int min_events, int max_events);
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
|
|||
/* properties that are always inherited */
|
||||
p.flags |= (ctx->flags & COPY_FLAGS);
|
||||
|
||||
ret = io_uring_fill_params(p.sq_entries, &p);
|
||||
ret = io_uring_fill_params(&p);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue