public inbox for io-uring@vger.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>, io-uring@vger.kernel.org
Subject: Re: [PATCH 3/3] io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks
Date: Fri, 22 Aug 2025 09:18:03 +0800	[thread overview]
Message-ID: <aKfFS9kcSuP0_aeV@fedora> (raw)
In-Reply-To: <20250821163308.977915-4-csander@purestorage.com>

On Thu, Aug 21, 2025 at 10:33:08AM -0600, Caleb Sander Mateos wrote:
> io_uring_cmd_prep() checks that REQ_F_BUFFER_SELECT is set in the
> io_kiocb's flags iff IORING_URING_CMD_MULTISHOT is set in the SQE's
> uring_cmd_flags. Consolidate the IORING_URING_CMD_MULTISHOT and
> !IORING_URING_CMD_MULTISHOT branches into a single check that the
> IORING_URING_CMD_MULTISHOT flag matches the REQ_F_BUFFER_SELECT flag.
> 
> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
> ---
>  io_uring/uring_cmd.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
> index c8fd204f6892..482cc5be1f8d 100644
> --- a/io_uring/uring_cmd.c
> +++ b/io_uring/uring_cmd.c
> @@ -199,17 +199,13 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>  		if (ioucmd->flags & IORING_URING_CMD_MULTISHOT)
>  			return -EINVAL;
>  		req->buf_index = READ_ONCE(sqe->buf_index);
>  	}
>  
> -	if (ioucmd->flags & IORING_URING_CMD_MULTISHOT) {
> -		if (!(req->flags & REQ_F_BUFFER_SELECT))
> -			return -EINVAL;
> -	} else {
> -		if (req->flags & REQ_F_BUFFER_SELECT)
> -			return -EINVAL;
> -	}
> +	if (!!(ioucmd->flags & IORING_URING_CMD_MULTISHOT) !=
> +	    !!(req->flags & REQ_F_BUFFER_SELECT))
> +		return -EINVAL;

Reviewed-by: Ming Lei <ming.lei@redhat.com>


Thanks,
Ming


  reply	other threads:[~2025-08-22  1:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21 16:33 [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups Caleb Sander Mateos
2025-08-21 16:33 ` [PATCH 1/3] io_uring/cmd: fix io_uring_mshot_cmd_post_cqe() for !CONFIG_IO_URING Caleb Sander Mateos
2025-08-21 16:38   ` Jens Axboe
2025-08-21 16:33 ` [PATCH 2/3] io_uring/cmd: deduplicate uring_cmd_flags checks Caleb Sander Mateos
2025-08-22  1:16   ` Ming Lei
2025-08-21 16:33 ` [PATCH 3/3] io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks Caleb Sander Mateos
2025-08-22  1:18   ` Ming Lei [this message]
2025-08-22  1:59 ` (subset) [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups 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=aKfFS9kcSuP0_aeV@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=io-uring@vger.kernel.org \
    /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