Skip to content

Commit

Permalink
io_uring: Remove unnecessary BUILD_BUG_ON
Browse files Browse the repository at this point in the history
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/[email protected]/

Signed-off-by: Breno Leitao <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Pavel Begunkov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
leitao authored and axboe committed May 4, 2023
1 parent fd9b854 commit d2b7fa6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
3 changes: 0 additions & 3 deletions io_uring/uring_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ int io_uring_cmd_prep_async(struct io_kiocb *req)
{
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);

BUILD_BUG_ON(uring_cmd_pdu_size(0) != 16);
BUILD_BUG_ON(uring_cmd_pdu_size(1) != 80);

memcpy(req->async_data, ioucmd->sqe, uring_sqe_size(req->ctx));
ioucmd->sqe = req->async_data;
return 0;
Expand Down
8 changes: 0 additions & 8 deletions io_uring/uring_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@
int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags);
int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
int io_uring_cmd_prep_async(struct io_kiocb *req);

/*
* The URING_CMD payload starts at 'cmd' in the first sqe, and continues into
* the following sqe if SQE128 is used.
*/
#define uring_cmd_pdu_size(is_sqe128) \
((1 + !!(is_sqe128)) * sizeof(struct io_uring_sqe) - \
offsetof(struct io_uring_sqe, cmd))

0 comments on commit d2b7fa6

Please sign in to comment.