From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 4/4] io_uring: inline io_complete_rw_common()
Date: Thu, 11 Feb 2021 18:28:23 +0000 [thread overview]
Message-ID: <45b309d7d1ec54f34c429997a18f7743b98a6632.1613067783.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
__io_complete_rw() casts request to kiocb for it to be immediately
contaier_of()'ed by io_complete_rw_common(). And the last function's
name doesn't do a great job of illuminating about its purposes, so just
inline it in its only user.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 26 +++++++++-----------------
1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 81f674f7a97a..c8b2b4c257c2 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2758,22 +2758,6 @@ static void kiocb_end_write(struct io_kiocb *req)
file_end_write(req->file);
}
-static void io_complete_rw_common(struct kiocb *kiocb, long res,
- unsigned int issue_flags)
-{
- struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb);
- int cflags = 0;
-
- if (kiocb->ki_flags & IOCB_WRITE)
- kiocb_end_write(req);
-
- if (res != req->result)
- req_set_fail_links(req);
- if (req->flags & REQ_F_BUFFER_SELECTED)
- cflags = io_put_rw_kbuf(req);
- __io_req_complete(req, issue_flags, res, cflags);
-}
-
#ifdef CONFIG_BLOCK
static bool io_resubmit_prep(struct io_kiocb *req)
{
@@ -2837,10 +2821,18 @@ static bool io_rw_reissue(struct io_kiocb *req)
static void __io_complete_rw(struct io_kiocb *req, long res, long res2,
unsigned int issue_flags)
{
+ int cflags = 0;
+
if ((res == -EAGAIN || res == -EOPNOTSUPP) && io_rw_reissue(req))
return;
+ if (res != req->result)
+ req_set_fail_links(req);
- io_complete_rw_common(&req->rw.kiocb, res, issue_flags);
+ if (req->rw.kiocb.ki_flags & IOCB_WRITE)
+ kiocb_end_write(req);
+ if (req->flags & REQ_F_BUFFER_SELECTED)
+ cflags = io_put_rw_kbuf(req);
+ __io_req_complete(req, issue_flags, res, cflags);
}
static void io_complete_rw(struct kiocb *kiocb, long res, long res2)
--
2.24.0
next prev parent reply other threads:[~2021-02-11 18:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-11 18:28 [PATCH for-next 0/4] complete cleanups Pavel Begunkov
2021-02-11 18:28 ` [PATCH 1/4] io_uring: clean up io_req_free_batch_finish() Pavel Begunkov
2021-02-11 18:28 ` [PATCH 2/4] io_uring: simplify iopoll reissuing Pavel Begunkov
2021-02-11 18:28 ` [PATCH 3/4] io_uring: move res check out of io_rw_reissue() Pavel Begunkov
2021-02-11 18:28 ` Pavel Begunkov [this message]
2021-02-11 19:55 ` [PATCH for-next 0/4] complete cleanups Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45b309d7d1ec54f34c429997a18f7743b98a6632.1613067783.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox