public inbox for [email protected]
 help / color / mirror / Atom feed
From: Caleb Sander Mateos <[email protected]>
To: Pavel Begunkov <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 1/4] io_uring/rw: allocate async data in io_prep_rw()
Date: Mon, 24 Feb 2025 08:52:32 -0800	[thread overview]
Message-ID: <CADUfDZp7SWy_pcL+GL9SbFY-qMaNV+gja+gRiY=XeefDoZjnDQ@mail.gmail.com> (raw)
In-Reply-To: <2bedcfe941cd2b594c4ee1658276f5c1b008feb8.1740412523.git.asml.silence@gmail.com>

On Mon, Feb 24, 2025 at 8:07 AM Pavel Begunkov <[email protected]> wrote:
>
> io_prep_rw() relies on async_data being allocated in io_prep_rw_setup().
> Be a bit more explicit and move the allocation earlier into io_prep_rw()
> and don't hide it in a call chain.

Hmm, where is async_data currently used in io_prep_rw()? I don't see
any reference to async_data in io_prep_rw() until your patch 4,
"io_uring/rw: open code io_prep_rw_setup()". Would it make sense to
combine the 2 patches?

Best,
Caleb

>
> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
>  io_uring/rw.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/io_uring/rw.c b/io_uring/rw.c
> index 22612a956e75..7efc2337c5a0 100644
> --- a/io_uring/rw.c
> +++ b/io_uring/rw.c
> @@ -203,9 +203,6 @@ static int io_prep_rw_setup(struct io_kiocb *req, int ddir, bool do_import)
>  {
>         struct io_async_rw *rw;
>
> -       if (io_rw_alloc_async(req))
> -               return -ENOMEM;
> -
>         if (!do_import || io_do_buffer_select(req))
>                 return 0;
>
> @@ -262,6 +259,9 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
>         u64 attr_type_mask;
>         int ret;
>
> +       if (io_rw_alloc_async(req))
> +               return -ENOMEM;
> +
>         rw->kiocb.ki_pos = READ_ONCE(sqe->off);
>         /* used for fixed read/write too - just read unconditionally */
>         req->buf_index = READ_ONCE(sqe->buf_index);
> --
> 2.48.1
>
>

  reply	other threads:[~2025-02-24 16:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 16:07 [PATCH 0/4] clean up rw buffer import Pavel Begunkov
2025-02-24 16:07 ` [PATCH 1/4] io_uring/rw: allocate async data in io_prep_rw() Pavel Begunkov
2025-02-24 16:52   ` Caleb Sander Mateos [this message]
2025-02-24 19:21     ` Pavel Begunkov
2025-02-24 19:44       ` Pavel Begunkov
2025-02-24 16:07 ` [PATCH 2/4] io_uring/rw: rename io_import_iovec() Pavel Begunkov
2025-02-24 16:07 ` [PATCH 3/4] io_uring/rw: extract helper for iovec import Pavel Begunkov
2025-02-24 16:48   ` Caleb Sander Mateos
2025-02-24 19:11     ` Pavel Begunkov
2025-02-24 16:07 ` [PATCH 4/4] io_uring/rw: open code io_prep_rw_setup() Pavel Begunkov

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='CADUfDZp7SWy_pcL+GL9SbFY-qMaNV+gja+gRiY=XeefDoZjnDQ@mail.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