Skip to content

Commit 2e6dbb2

Browse files
calebsanderaxboe
authored andcommitted
io_uring/cmd: remove struct io_uring_cmd_data
There are no more users of struct io_uring_cmd_data and its op_data field. Remove it to shave 8 bytes from struct io_async_cmd and eliminate a store and load for every uring_cmd. Signed-off-by: Caleb Sander Mateos <[email protected]> Acked-by: David Sterba <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 9aad72b commit 2e6dbb2

3 files changed

Lines changed: 1 addition & 21 deletions

File tree

include/linux/io_uring/cmd.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ struct io_uring_cmd {
2121
u8 pdu[32]; /* available inline for free use */
2222
};
2323

24-
struct io_uring_cmd_data {
25-
void *op_data;
26-
};
27-
2824
static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
2925
{
3026
return sqe->cmd;
@@ -137,11 +133,6 @@ static inline struct task_struct *io_uring_cmd_get_task(struct io_uring_cmd *cmd
137133
return cmd_to_io_kiocb(cmd)->tctx->task;
138134
}
139135

140-
static inline struct io_uring_cmd_data *io_uring_cmd_get_async_data(struct io_uring_cmd *cmd)
141-
{
142-
return cmd_to_io_kiocb(cmd)->async_data;
143-
}
144-
145136
/*
146137
* Return uring_cmd's context reference as its context handle for driver to
147138
* track per-context resource, such as registered kernel IO buffer

io_uring/uring_cmd.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ static void io_req_uring_cleanup(struct io_kiocb *req, unsigned int issue_flags)
2626
{
2727
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
2828
struct io_async_cmd *ac = req->async_data;
29-
struct io_uring_cmd_data *cache = &ac->data;
30-
31-
if (cache->op_data) {
32-
kfree(cache->op_data);
33-
cache->op_data = NULL;
34-
}
3529

3630
if (issue_flags & IO_URING_F_UNLOCKED)
3731
return;
@@ -40,7 +34,7 @@ static void io_req_uring_cleanup(struct io_kiocb *req, unsigned int issue_flags)
4034
if (ac->vec.nr > IO_VEC_CACHE_SOFT_CAP)
4135
io_vec_free(&ac->vec);
4236

43-
if (io_alloc_cache_put(&req->ctx->cmd_cache, cache)) {
37+
if (io_alloc_cache_put(&req->ctx->cmd_cache, ac)) {
4438
ioucmd->sqe = NULL;
4539
req->async_data = NULL;
4640
req->flags &= ~(REQ_F_ASYNC_DATA|REQ_F_NEED_CLEANUP);
@@ -193,9 +187,6 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
193187
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
194188
struct io_async_cmd *ac;
195189

196-
/* see io_uring_cmd_get_async_data() */
197-
BUILD_BUG_ON(offsetof(struct io_async_cmd, data) != 0);
198-
199190
if (sqe->__pad1)
200191
return -EINVAL;
201192

@@ -211,7 +202,6 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
211202
ac = io_uring_alloc_async_data(&req->ctx->cmd_cache, req);
212203
if (!ac)
213204
return -ENOMEM;
214-
ac->data.op_data = NULL;
215205
ioucmd->sqe = sqe;
216206
return 0;
217207
}

io_uring/uring_cmd.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <linux/io_uring_types.h>
55

66
struct io_async_cmd {
7-
struct io_uring_cmd_data data;
87
struct iou_vec vec;
98
struct io_uring_sqe sqes[2];
109
};

0 commit comments

Comments
 (0)