Skip to content

Commit 5a56946

Browse files
isilenceaxboe
authored andcommitted
io_uring/notif: simplify io_notif_flush()
io_notif_flush() is partially duplicating io_tx_ubuf_complete(), so instead of duplicating it, make the flush call io_tx_ubuf_complete. Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/19e41652c16718b946a5c80d2ad409df7682e47e.1713369317.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 3830fff commit 5a56946

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

io_uring/notif.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "notif.h"
1010
#include "rsrc.h"
1111

12-
void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts)
12+
static void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts)
1313
{
1414
struct io_notif_data *nd = io_notif_to_data(notif);
1515

@@ -23,8 +23,8 @@ void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts)
2323
io_req_task_complete(notif, ts);
2424
}
2525

26-
static void io_tx_ubuf_complete(struct sk_buff *skb, struct ubuf_info *uarg,
27-
bool success)
26+
void io_tx_ubuf_complete(struct sk_buff *skb, struct ubuf_info *uarg,
27+
bool success)
2828
{
2929
struct io_notif_data *nd = container_of(uarg, struct io_notif_data, uarg);
3030
struct io_kiocb *notif = cmd_to_io_kiocb(nd);

io_uring/notif.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ struct io_notif_data {
2121
};
2222

2323
struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx);
24-
void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts);
24+
void io_tx_ubuf_complete(struct sk_buff *skb, struct ubuf_info *uarg,
25+
bool success);
2526

2627
static inline struct io_notif_data *io_notif_to_data(struct io_kiocb *notif)
2728
{
@@ -33,11 +34,7 @@ static inline void io_notif_flush(struct io_kiocb *notif)
3334
{
3435
struct io_notif_data *nd = io_notif_to_data(notif);
3536

36-
/* drop slot's master ref */
37-
if (refcount_dec_and_test(&nd->uarg.refcnt)) {
38-
notif->io_task_work.func = io_notif_tw_complete;
39-
__io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE);
40-
}
37+
io_tx_ubuf_complete(NULL, &nd->uarg, true);
4138
}
4239

4340
static inline int io_notif_account_mem(struct io_kiocb *notif, unsigned len)

0 commit comments

Comments
 (0)