Skip to content

Commit d2b7fa6

Browse files
leitaoaxboe
authored andcommitted
io_uring: Remove unnecessary BUILD_BUG_ON
In the io_uring_cmd_prep_async() there is an unnecessary compilation time check to check if cmd is correctly placed at field 48 of the SQE. This is unnecessary, since this check is already in place at io_uring_init(): BUILD_BUG_SQE_ELEM(48, __u64, addr3); Remove it and the uring_cmd_pdu_size() function, which is not used anymore. Keith started a discussion about this topic in the following thread: Link: https://lore.kernel.org/lkml/ZDBmQOhbyU0iLhMw@kbusch-mbp.dhcp.thefacebook.com/ Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/20230504121856.904491-4-leitao@debian.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent fd9b854 commit d2b7fa6

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

io_uring/uring_cmd.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ int io_uring_cmd_prep_async(struct io_kiocb *req)
7070
{
7171
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
7272

73-
BUILD_BUG_ON(uring_cmd_pdu_size(0) != 16);
74-
BUILD_BUG_ON(uring_cmd_pdu_size(1) != 80);
75-
7673
memcpy(req->async_data, ioucmd->sqe, uring_sqe_size(req->ctx));
7774
ioucmd->sqe = req->async_data;
7875
return 0;

io_uring/uring_cmd.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,3 @@
33
int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags);
44
int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
55
int io_uring_cmd_prep_async(struct io_kiocb *req);
6-
7-
/*
8-
* The URING_CMD payload starts at 'cmd' in the first sqe, and continues into
9-
* the following sqe if SQE128 is used.
10-
*/
11-
#define uring_cmd_pdu_size(is_sqe128) \
12-
((1 + !!(is_sqe128)) * sizeof(struct io_uring_sqe) - \
13-
offsetof(struct io_uring_sqe, cmd))

0 commit comments

Comments
 (0)