From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Sebastian Chlad <sebastian.chlad@suse.com>
Cc: Sebastian Chlad <sebastianchlad@gmail.com>, linux-block@vger.kernel.org
Subject: Re: [PATCH 1/2 blktests] src/miniublk: switch to ioctl-encoded ublk commands
Date: Tue, 23 Jun 2026 07:21:36 +0900 [thread overview]
Message-ID: <ajm0FkGiQU_nA6U7@shinmob> (raw)
In-Reply-To: <CAJR+Y9K=0C+TnKAycdXbeQF98FE=RhaYYvK6SCpLPbdeMH2Xxw@mail.gmail.com>
On Jun 22, 2026 / 15:34, Sebastian Chlad wrote:
[...]
> > > diff --git a/src/miniublk.c b/src/miniublk.c
> > > index f98f850..5a35ca7 100644
> > > --- a/src/miniublk.c
> > > +++ b/src/miniublk.c
> > [...]
> > > @@ -624,9 +624,9 @@ static int ublk_queue_io_cmd(struct ublk_queue *q,
> > > return 0;
> > >
> > > if (io->flags & UBLKSRV_NEED_COMMIT_RQ_COMP)
> > > - cmd_op = UBLK_IO_COMMIT_AND_FETCH_REQ;
> > > - else if (io->flags & UBLKSRV_NEED_FETCH_RQ)
> > > - cmd_op = UBLK_IO_FETCH_REQ;
> > > + cmd_op = UBLK_U_IO_COMMIT_AND_FETCH_REQ;
> > > + else
> > > + cmd_op = UBLK_U_IO_FETCH_REQ;
> >
> > The hunk above changes the "else if" part, is this intentional?
> >
>
> Yes, this is intentional because we already check things in
> if (!(io->flags &
> (UBLKSRV_NEED_FETCH_RQ | UBLKSRV_NEED_COMMIT_RQ_COMP)))
> which returns early if neither flag is set, so checking the first
> condition makes another check redundant as by that
> time we know we need UBLK_U_IO_FETCH_REQ.
Thanks for the explanation. Now I see your point.
>
> However if you think it's safer to still check if io->flags &
> UBLKSRV_NEED_FETCH_RQ, I can implement it this way in the v2.
> Let me know what you prefer.
I think it's the better to keep the current
"else if (io->flags & UBLKSRV_NEED_FETCH_RQ)"
form. Even though the change is small and will not affect the code behavior, it
is against "single purpose with single patch" guide. Anyone who looks at the
commit in future may have the same question as mine.
next prev parent reply other threads:[~2026-06-22 22:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-17 7:25 [PATCH 0/2 blktests] Update the miniublk to use ioctl opcodes Sebastian Chlad
2026-06-17 7:25 ` [PATCH 1/2 blktests] src/miniublk: switch to ioctl-encoded ublk commands Sebastian Chlad
2026-06-19 3:26 ` Shin'ichiro Kawasaki
2026-06-22 13:34 ` Sebastian Chlad
2026-06-22 22:21 ` Shin'ichiro Kawasaki [this message]
2026-06-17 7:25 ` [PATCH 2/2 blktests] src/miniublk: fall back to legacy opcodes on older kernels Sebastian Chlad
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=ajm0FkGiQU_nA6U7@shinmob \
--to=shinichiro.kawasaki@wdc.com \
--cc=linux-block@vger.kernel.org \
--cc=sebastian.chlad@suse.com \
--cc=sebastianchlad@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox