Skip to content

Commit 96c7d4f

Browse files
leitaoaxboe
authored andcommitted
io_uring: Create a helper to return the SQE size
Create a simple helper that returns the size of the SQE. The SQE could have two size, depending of the flags. If IO_URING_SETUP_SQE128 flag is set, then return a double SQE, otherwise returns the sizeof of io_uring_sqe (64 bytes). 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-2-leitao@debian.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 776617d commit 96c7d4f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

io_uring/io_uring.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,4 +394,14 @@ static inline void io_req_queue_tw_complete(struct io_kiocb *req, s32 res)
394394
io_req_task_work_add(req);
395395
}
396396

397+
/*
398+
* IORING_SETUP_SQE128 contexts allocate twice the normal SQE size for each
399+
* slot.
400+
*/
401+
static inline size_t uring_sqe_size(struct io_ring_ctx *ctx)
402+
{
403+
if (ctx->flags & IORING_SETUP_SQE128)
404+
return 2 * sizeof(struct io_uring_sqe);
405+
return sizeof(struct io_uring_sqe);
406+
}
397407
#endif

0 commit comments

Comments
 (0)