Re: [PATCH for-next v2 11/25] io_uring: refactor io_req_task_complete()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/14/22 18:45, Hao Xu wrote:
On 6/14/22 22:37, Pavel Begunkov wrote:
Clean up io_req_task_complete() and deduplicate io_put_kbuf() calls.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
  io_uring/io_uring.c | 16 ++++++++++------
  1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index fcee58c6c35e..0f6edf82f262 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1857,15 +1857,19 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, long min)
      return ret;
  }
-inline void io_req_task_complete(struct io_kiocb *req, bool *locked)
+
+void io_req_task_complete(struct io_kiocb *req, bool *locked)
  {
-    if (*locked) {
-        req->cqe.flags |= io_put_kbuf(req, 0);
+    if (req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING)) {
+        unsigned issue_flags = *locked ? IO_URING_F_UNLOCKED : 0;

should be *locked ? 0 : IO_URING_F_UNLOCKED; I think?. I haven't look
into the whole series carefully, will do that tomorrow.

Yeah, it should... Thanks


+
+        req->cqe.flags |= io_put_kbuf(req, issue_flags);
+    }
+
+    if (*locked)
          io_req_add_compl_list(req);
-    } else {
-        req->cqe.flags |= io_put_kbuf(req, IO_URING_F_UNLOCKED);
+    else
          io_req_complete_post(req);
-    }
  }
  /*


--
Pavel Begunkov



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux