Commit 5a569469 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

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: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/19e41652c16718b946a5c80d2ad409df7682e47e.1713369317.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3830fff3
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "notif.h" #include "notif.h"
#include "rsrc.h" #include "rsrc.h"
void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts) static void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts)
{ {
struct io_notif_data *nd = io_notif_to_data(notif); struct io_notif_data *nd = io_notif_to_data(notif);
...@@ -23,7 +23,7 @@ void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts) ...@@ -23,7 +23,7 @@ void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts)
io_req_task_complete(notif, ts); io_req_task_complete(notif, ts);
} }
static void io_tx_ubuf_complete(struct sk_buff *skb, struct ubuf_info *uarg, void io_tx_ubuf_complete(struct sk_buff *skb, struct ubuf_info *uarg,
bool success) bool success)
{ {
struct io_notif_data *nd = container_of(uarg, struct io_notif_data, uarg); struct io_notif_data *nd = container_of(uarg, struct io_notif_data, uarg);
......
...@@ -21,7 +21,8 @@ struct io_notif_data { ...@@ -21,7 +21,8 @@ struct io_notif_data {
}; };
struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx); struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx);
void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts); void io_tx_ubuf_complete(struct sk_buff *skb, struct ubuf_info *uarg,
bool success);
static inline struct io_notif_data *io_notif_to_data(struct io_kiocb *notif) static inline struct io_notif_data *io_notif_to_data(struct io_kiocb *notif)
{ {
...@@ -33,11 +34,7 @@ static inline void io_notif_flush(struct io_kiocb *notif) ...@@ -33,11 +34,7 @@ static inline void io_notif_flush(struct io_kiocb *notif)
{ {
struct io_notif_data *nd = io_notif_to_data(notif); struct io_notif_data *nd = io_notif_to_data(notif);
/* drop slot's master ref */ io_tx_ubuf_complete(NULL, &nd->uarg, true);
if (refcount_dec_and_test(&nd->uarg.refcnt)) {
notif->io_task_work.func = io_notif_tw_complete;
__io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE);
}
} }
static inline int io_notif_account_mem(struct io_kiocb *notif, unsigned len) static inline int io_notif_account_mem(struct io_kiocb *notif, unsigned len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment