Skip to content

Commit 6b04a37

Browse files
isilenceaxboe
authored andcommitted
io_uring/cmd: inline io_uring_cmd_do_in_task_lazy
Now as we can easily include io_uring_types.h, move IOU_F_TWQ_LAZY_WAKE and inline io_uring_cmd_do_in_task_lazy(). Signed-off-by: Pavel Begunkov <[email protected]> Reviewed-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/2ec9fb31dd192d1c5cf26d0a2dec5657d88a8e48.1701391955.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent b66509b commit 6b04a37

File tree

4 files changed

+27
-32
lines changed

4 files changed

+27
-32
lines changed

include/linux/io_uring/cmd.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t res2,
3636
void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
3737
void (*task_work_cb)(struct io_uring_cmd *, unsigned),
3838
unsigned flags);
39-
/* users should follow semantics of IOU_F_TWQ_LAZY_WAKE */
40-
void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucmd,
41-
void (*task_work_cb)(struct io_uring_cmd *, unsigned));
42-
43-
static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
44-
void (*task_work_cb)(struct io_uring_cmd *, unsigned))
45-
{
46-
__io_uring_cmd_do_in_task(ioucmd, task_work_cb, 0);
47-
}
4839

4940
void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
5041
unsigned int issue_flags);
@@ -60,12 +51,9 @@ static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret,
6051
ssize_t ret2, unsigned issue_flags)
6152
{
6253
}
63-
static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
64-
void (*task_work_cb)(struct io_uring_cmd *, unsigned))
65-
{
66-
}
67-
static inline void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucmd,
68-
void (*task_work_cb)(struct io_uring_cmd *, unsigned))
54+
static inline void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
55+
void (*task_work_cb)(struct io_uring_cmd *, unsigned),
56+
unsigned flags)
6957
{
7058
}
7159
static inline void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
@@ -78,4 +66,17 @@ static inline struct task_struct *io_uring_cmd_get_task(struct io_uring_cmd *cmd
7866
}
7967
#endif
8068

69+
/* users must follow the IOU_F_TWQ_LAZY_WAKE semantics */
70+
static inline void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucmd,
71+
void (*task_work_cb)(struct io_uring_cmd *, unsigned))
72+
{
73+
__io_uring_cmd_do_in_task(ioucmd, task_work_cb, IOU_F_TWQ_LAZY_WAKE);
74+
}
75+
76+
static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
77+
void (*task_work_cb)(struct io_uring_cmd *, unsigned))
78+
{
79+
__io_uring_cmd_do_in_task(ioucmd, task_work_cb, 0);
80+
}
81+
8182
#endif /* _LINUX_IO_URING_CMD_H */

include/linux/io_uring_types.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
#include <linux/llist.h>
88
#include <uapi/linux/io_uring.h>
99

10+
enum {
11+
/*
12+
* A hint to not wake right away but delay until there are enough of
13+
* tw's queued to match the number of CQEs the task is waiting for.
14+
*
15+
* Must not be used wirh requests generating more than one CQE.
16+
* It's also ignored unless IORING_SETUP_DEFER_TASKRUN is set.
17+
*/
18+
IOU_F_TWQ_LAZY_WAKE = 1,
19+
};
20+
1021
enum io_uring_cmd_flags {
1122
IO_URING_F_COMPLETE_DEFER = 1,
1223
IO_URING_F_UNLOCKED = 2,

io_uring/io_uring.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@
1515
#include <trace/events/io_uring.h>
1616
#endif
1717

18-
enum {
19-
/*
20-
* A hint to not wake right away but delay until there are enough of
21-
* tw's queued to match the number of CQEs the task is waiting for.
22-
*
23-
* Must not be used wirh requests generating more than one CQE.
24-
* It's also ignored unless IORING_SETUP_DEFER_TASKRUN is set.
25-
*/
26-
IOU_F_TWQ_LAZY_WAKE = 1,
27-
};
2818

2919
enum {
3020
IOU_OK = 0,

io_uring/uring_cmd.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,6 @@ void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
7878
}
7979
EXPORT_SYMBOL_GPL(__io_uring_cmd_do_in_task);
8080

81-
void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucmd,
82-
void (*task_work_cb)(struct io_uring_cmd *, unsigned))
83-
{
84-
__io_uring_cmd_do_in_task(ioucmd, task_work_cb, IOU_F_TWQ_LAZY_WAKE);
85-
}
86-
EXPORT_SYMBOL_GPL(io_uring_cmd_do_in_task_lazy);
87-
8881
static inline void io_req_set_cqe32_extra(struct io_kiocb *req,
8982
u64 extra1, u64 extra2)
9083
{

0 commit comments

Comments
 (0)