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/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>

Jens Axboe ead21053 af19388a

+13 -21
+13 -21
io_uring/uring_cmd.c
··· 181 181 } 182 182 EXPORT_SYMBOL_GPL(io_uring_cmd_done); 183 183 184 - static int io_uring_cmd_prep_setup(struct io_kiocb *req, 185 - const struct io_uring_sqe *sqe) 184 + int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) 186 185 { 187 186 struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd); 188 187 struct io_async_cmd *ac; 189 188 190 189 /* see io_uring_cmd_get_async_data() */ 191 190 BUILD_BUG_ON(offsetof(struct io_async_cmd, data) != 0); 191 + 192 + if (sqe->__pad1) 193 + return -EINVAL; 194 + 195 + ioucmd->flags = READ_ONCE(sqe->uring_cmd_flags); 196 + if (ioucmd->flags & ~IORING_URING_CMD_MASK) 197 + return -EINVAL; 198 + 199 + if (ioucmd->flags & IORING_URING_CMD_FIXED) 200 + req->buf_index = READ_ONCE(sqe->buf_index); 201 + 202 + ioucmd->cmd_op = READ_ONCE(sqe->cmd_op); 192 203 193 204 ac = io_uring_alloc_async_data(&req->ctx->cmd_cache, req); 194 205 if (!ac) ··· 216 205 memcpy(ac->sqes, sqe, uring_sqe_size(req->ctx)); 217 206 ioucmd->sqe = ac->sqes; 218 207 return 0; 219 - } 220 - 221 - int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) 222 - { 223 - struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd); 224 - 225 - if (sqe->__pad1) 226 - return -EINVAL; 227 - 228 - ioucmd->flags = READ_ONCE(sqe->uring_cmd_flags); 229 - if (ioucmd->flags & ~IORING_URING_CMD_MASK) 230 - return -EINVAL; 231 - 232 - if (ioucmd->flags & IORING_URING_CMD_FIXED) 233 - req->buf_index = READ_ONCE(sqe->buf_index); 234 - 235 - ioucmd->cmd_op = READ_ONCE(sqe->cmd_op); 236 - 237 - return io_uring_cmd_prep_setup(req, sqe); 238 208 } 239 209 240 210 int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)