Skip to content

Commit 7e58d0a

Browse files
isilenceaxboe
authored andcommitted
io_uring/notif: refactor io_tx_ubuf_complete()
Flip the dec_and_test "if", that makes the function extension easier in the future. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/43939e2b04dff03bff5d7227c98afedf951227b3.1713185320.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 686b56c commit 7e58d0a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

io_uring/notif.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ static void io_tx_ubuf_callback(struct sk_buff *skb, struct ubuf_info *uarg,
3737
WRITE_ONCE(nd->zc_copied, true);
3838
}
3939

40-
if (refcount_dec_and_test(&uarg->refcnt)) {
41-
notif->io_task_work.func = io_notif_tw_complete;
42-
__io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE);
43-
}
40+
if (!refcount_dec_and_test(&uarg->refcnt))
41+
return;
42+
43+
notif->io_task_work.func = io_notif_tw_complete;
44+
__io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE);
4445
}
4546

4647
struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx)

0 commit comments

Comments
 (0)