io_uring/uring_cmd: get rid of io_uring_cmd_prep_setup()
It's a pretty pointless helper, just allocates and copies data. Fold it into io_uring_cmd_prep(). Reviewed-by: Caleb Sander Mateos <csander@purestorage.com> Reviewed-by: Anuj Gupta <anuj20.g@samsung.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>pull/1279/head
parent
af19388a97
commit
ead21053bf
|
|
@ -181,8 +181,7 @@ void io_uring_cmd_done(struct io_uring_cmd *ioucmd, ssize_t ret, u64 res2,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(io_uring_cmd_done);
|
||||
|
||||
static int io_uring_cmd_prep_setup(struct io_kiocb *req,
|
||||
const struct io_uring_sqe *sqe)
|
||||
int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
{
|
||||
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
|
||||
struct io_async_cmd *ac;
|
||||
|
|
@ -190,6 +189,18 @@ static int io_uring_cmd_prep_setup(struct io_kiocb *req,
|
|||
/* see io_uring_cmd_get_async_data() */
|
||||
BUILD_BUG_ON(offsetof(struct io_async_cmd, data) != 0);
|
||||
|
||||
if (sqe->__pad1)
|
||||
return -EINVAL;
|
||||
|
||||
ioucmd->flags = READ_ONCE(sqe->uring_cmd_flags);
|
||||
if (ioucmd->flags & ~IORING_URING_CMD_MASK)
|
||||
return -EINVAL;
|
||||
|
||||
if (ioucmd->flags & IORING_URING_CMD_FIXED)
|
||||
req->buf_index = READ_ONCE(sqe->buf_index);
|
||||
|
||||
ioucmd->cmd_op = READ_ONCE(sqe->cmd_op);
|
||||
|
||||
ac = io_uring_alloc_async_data(&req->ctx->cmd_cache, req);
|
||||
if (!ac)
|
||||
return -ENOMEM;
|
||||
|
|
@ -207,25 +218,6 @@ static int io_uring_cmd_prep_setup(struct io_kiocb *req,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
{
|
||||
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
|
||||
|
||||
if (sqe->__pad1)
|
||||
return -EINVAL;
|
||||
|
||||
ioucmd->flags = READ_ONCE(sqe->uring_cmd_flags);
|
||||
if (ioucmd->flags & ~IORING_URING_CMD_MASK)
|
||||
return -EINVAL;
|
||||
|
||||
if (ioucmd->flags & IORING_URING_CMD_FIXED)
|
||||
req->buf_index = READ_ONCE(sqe->buf_index);
|
||||
|
||||
ioucmd->cmd_op = READ_ONCE(sqe->cmd_op);
|
||||
|
||||
return io_uring_cmd_prep_setup(req, sqe);
|
||||
}
|
||||
|
||||
int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)
|
||||
{
|
||||
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
|
||||
|
|
|
|||
Loading…
Reference in New Issue