diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2024-04-15 13:50:11 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-04-15 08:10:49 -0600 |
commit | 7e58d0af5a587e74f46f55b91a0197f750eba78c (patch) | |
tree | 9e916fa70db1a0d02d89760e823da9ec8343bc0c | |
parent | 686b56cbeedc9f4c72f9bb781918194a9a3e8334 (diff) | |
download | linux-stable-7e58d0af5a587e74f46f55b91a0197f750eba78c.tar.gz linux-stable-7e58d0af5a587e74f46f55b91a0197f750eba78c.tar.bz2 linux-stable-7e58d0af5a587e74f46f55b91a0197f750eba78c.zip |
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 <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/43939e2b04dff03bff5d7227c98afedf951227b3.1713185320.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | io_uring/notif.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/io_uring/notif.c b/io_uring/notif.c index b561bd763435..452c255de04a 100644 --- a/io_uring/notif.c +++ b/io_uring/notif.c @@ -37,10 +37,11 @@ static void io_tx_ubuf_callback(struct sk_buff *skb, struct ubuf_info *uarg, WRITE_ONCE(nd->zc_copied, true); } - if (refcount_dec_and_test(&uarg->refcnt)) { - notif->io_task_work.func = io_notif_tw_complete; - __io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE); - } + if (!refcount_dec_and_test(&uarg->refcnt)) + return; + + notif->io_task_work.func = io_notif_tw_complete; + __io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE); } struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx) |