All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	Uday Shankar <ushankar@purestorage.com>
Subject: Re: [PATCH V2 03/16] ublk: let ublk_fill_io_cmd() cover more things
Date: Sun, 13 Jul 2025 10:34:55 +0800	[thread overview]
Message-ID: <aHMbT0OUBEoiy7AY@fedora> (raw)
In-Reply-To: <CADUfDZrW3NsusYmYo4gsRCDv8Yb3oWZYrVfhDUe219xqFTue=A@mail.gmail.com>

On Fri, Jul 11, 2025 at 09:25:27AM -0400, Caleb Sander Mateos wrote:
> On Mon, Jul 7, 2025 at 9:18 PM Ming Lei <ming.lei@redhat.com> wrote:
> >
> > Let ublk_fill_io_cmd() cover more things:
> >
> > - store io command result
> >
> > - clear UBLK_IO_FLAG_OWNED_BY_SRV
> >
> > It is fine to do above for ublk_fetch(), ublk_commit_and_fetch() and
> > handling UBLK_IO_NEED_GET_DATA.
> >
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > ---
> >  drivers/block/ublk_drv.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> > index d7b5ee96978a..1ab2dc74424f 100644
> > --- a/drivers/block/ublk_drv.c
> > +++ b/drivers/block/ublk_drv.c
> > @@ -2003,11 +2003,16 @@ static inline int ublk_check_cmd_op(u32 cmd_op)
> >  }
> >
> >  static inline void ublk_fill_io_cmd(struct ublk_io *io,
> > -               struct io_uring_cmd *cmd, unsigned long buf_addr)
> > +               struct io_uring_cmd *cmd, unsigned long buf_addr,
> > +               int result)
> >  {
> >         io->cmd = cmd;
> >         io->flags |= UBLK_IO_FLAG_ACTIVE;
> >         io->addr = buf_addr;
> > +       io->res = result;
> 
> Hmm, only a single caller (ublk_commit_and_fetch()) needs to set
> io->res. It seems a bit weird to move it here.

OK, it can be kept outside ublk_fill_io_cmd() for ublk_commit_and_fetch()
only.

> 
> > +
> > +       /* now this cmd slot is owned by ublk driver */
> > +       io->flags &= ~UBLK_IO_FLAG_OWNED_BY_SRV;
> 
> I would have a slight preference for keeping the two updates of
> io->flags next to each other. The compiler may be able to optimize
> that better.

OK.


thanks,
Ming


  reply	other threads:[~2025-07-13  2:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08  1:17 [PATCH V2 00/16] ublk: cleanup for supporting batch IO command Ming Lei
2025-07-08  1:17 ` [PATCH V2 01/16] ublk: move fake timeout logic into __ublk_complete_rq() Ming Lei
2025-07-08  1:17 ` [PATCH V2 02/16] ublk: look up ublk task via its pid in timeout handler Ming Lei
2025-07-11 13:20   ` Caleb Sander Mateos
2025-07-13  2:31     ` Ming Lei
2025-07-08  1:17 ` [PATCH V2 03/16] ublk: let ublk_fill_io_cmd() cover more things Ming Lei
2025-07-11 13:25   ` Caleb Sander Mateos
2025-07-13  2:34     ` Ming Lei [this message]
2025-07-08  1:17 ` [PATCH V2 04/16] ublk: avoid to pass `struct ublksrv_io_cmd *` to ublk_commit_and_fetch() Ming Lei
2025-07-08  1:17 ` [PATCH V2 05/16] ublk: move auto buffer register handling into one dedicated helper Ming Lei
2025-07-11 13:47   ` Caleb Sander Mateos
2025-07-13  2:38     ` Ming Lei
2025-07-08  1:17 ` [PATCH V2 06/16] ublk: store auto buffer register data into `struct ublk_io` Ming Lei
2025-07-08  1:17 ` [PATCH V2 07/16] ublk: add helper ublk_check_fetch_buf() Ming Lei
2025-07-08  1:17 ` [PATCH V2 08/16] ublk: remove ublk_commit_and_fetch() Ming Lei
2025-07-08  1:17 ` [PATCH V2 09/16] ublk: pass 'const struct ublk_io *' to ublk_[un]map_io() Ming Lei
2025-07-08  1:17 ` [PATCH V2 10/16] selftests: ublk: remove `tag` parameter of ->tgt_io_done() Ming Lei
2025-07-08  1:17 ` [PATCH V2 11/16] selftests: ublk: pass 'ublk_thread *' to ->queue_io() and ->tgt_io_done() Ming Lei
2025-07-08  1:17 ` [PATCH V2 12/16] selftests: ublk: pass 'ublk_thread *' to more common helpers Ming Lei
2025-07-08  1:17 ` [PATCH V2 13/16] selftests: ublk: remove ublk queue self-defined flags Ming Lei
2025-07-08  1:17 ` [PATCH V2 14/16] selftests: ublk: improve flags naming Ming Lei
2025-07-08  1:17 ` [PATCH V2 15/16] selftests: ublk: add helper ublk_handle_uring_cmd() for handle ublk command Ming Lei
2025-07-08  1:17 ` [PATCH V2 16/16] selftests: ublk: add utils.h Ming Lei

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=aHMbT0OUBEoiy7AY@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ushankar@purestorage.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.