Just a preparation patch, moving several functions
(i.e. [__]io_req_complete(), io_submit_flush_completions()) below in
code to avoid extra declarations.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 96 +++++++++++++++++++++++++--------------------------
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 7038c4f08805..609c7da044d7 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1428,54 +1428,6 @@ static void io_cqring_add_event(struct io_kiocb *req, 
long res, long cflags)
        io_cqring_ev_posted(ctx);
 }
 
-static void io_submit_flush_completions(struct io_comp_state *cs)
-{
-       struct io_ring_ctx *ctx = cs->ctx;
-
-       spin_lock_irq(&ctx->completion_lock);
-       while (!list_empty(&cs->list)) {
-               struct io_kiocb *req;
-
-               req = list_first_entry(&cs->list, struct io_kiocb, compl.list);
-               list_del(&req->compl.list);
-               __io_cqring_fill_event(req, req->result, req->compl.cflags);
-               if (!(req->flags & REQ_F_LINK_HEAD)) {
-                       req->flags |= REQ_F_COMP_LOCKED;
-                       io_put_req(req);
-               } else {
-                       spin_unlock_irq(&ctx->completion_lock);
-                       io_put_req(req);
-                       spin_lock_irq(&ctx->completion_lock);
-               }
-       }
-       io_commit_cqring(ctx);
-       spin_unlock_irq(&ctx->completion_lock);
-
-       io_cqring_ev_posted(ctx);
-       cs->nr = 0;
-}
-
-static void __io_req_complete(struct io_kiocb *req, long res, unsigned cflags,
-                             struct io_comp_state *cs)
-{
-       if (!cs) {
-               io_cqring_add_event(req, res, cflags);
-               io_put_req(req);
-       } else {
-               io_clean_op(req);
-               req->result = res;
-               req->compl.cflags = cflags;
-               list_add_tail(&req->compl.list, &cs->list);
-               if (++cs->nr >= 32)
-                       io_submit_flush_completions(cs);
-       }
-}
-
-static void io_req_complete(struct io_kiocb *req, long res)
-{
-       __io_req_complete(req, res, 0, NULL);
-}
-
 static inline bool io_is_fallback_req(struct io_kiocb *req)
 {
        return req == (struct io_kiocb *)
@@ -1840,6 +1792,54 @@ static void io_req_free_batch(struct req_batch *rb, 
struct io_kiocb *req)
                __io_req_free_batch_flush(req->ctx, rb);
 }
 
+static void io_submit_flush_completions(struct io_comp_state *cs)
+{
+       struct io_ring_ctx *ctx = cs->ctx;
+
+       spin_lock_irq(&ctx->completion_lock);
+       while (!list_empty(&cs->list)) {
+               struct io_kiocb *req;
+
+               req = list_first_entry(&cs->list, struct io_kiocb, compl.list);
+               list_del(&req->compl.list);
+               __io_cqring_fill_event(req, req->result, req->compl.cflags);
+               if (!(req->flags & REQ_F_LINK_HEAD)) {
+                       req->flags |= REQ_F_COMP_LOCKED;
+                       io_put_req(req);
+               } else {
+                       spin_unlock_irq(&ctx->completion_lock);
+                       io_put_req(req);
+                       spin_lock_irq(&ctx->completion_lock);
+               }
+       }
+       io_commit_cqring(ctx);
+       spin_unlock_irq(&ctx->completion_lock);
+
+       io_cqring_ev_posted(ctx);
+       cs->nr = 0;
+}
+
+static void __io_req_complete(struct io_kiocb *req, long res, unsigned cflags,
+                             struct io_comp_state *cs)
+{
+       if (!cs) {
+               io_cqring_add_event(req, res, cflags);
+               io_put_req(req);
+       } else {
+               io_clean_op(req);
+               req->result = res;
+               req->compl.cflags = cflags;
+               list_add_tail(&req->compl.list, &cs->list);
+               if (++cs->nr >= 32)
+                       io_submit_flush_completions(cs);
+       }
+}
+
+static void io_req_complete(struct io_kiocb *req, long res)
+{
+       __io_req_complete(req, res, 0, NULL);
+}
+
 /*
  * Drop reference to request, return next in chain (if there is one) if this
  * was the last reference to this request.
-- 
2.24.0

Reply via email to