public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring/uring_cmd: assign ioucmd->cmd at async prep time
@ 2023-04-05 14:23 Jens Axboe
  2023-04-05 14:36 ` Gabriel Krisman Bertazi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jens Axboe @ 2023-04-05 14:23 UTC (permalink / raw)
  To: io-uring; +Cc: Kanchan Joshi

Rather than check this in the fast path issue, it makes more sense to
just assign the copy of the data when we're setting it up anyway. This
makes the code a bit cleaner, and removes the need for this check in
the issue path.

Signed-off-by: Jens Axboe <[email protected]>

---

diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index 3d825d939b13..f7a96bc76ea1 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -73,6 +73,7 @@ int io_uring_cmd_prep_async(struct io_kiocb *req)
 	cmd_size = uring_cmd_pdu_size(req->ctx->flags & IORING_SETUP_SQE128);
 
 	memcpy(req->async_data, ioucmd->cmd, cmd_size);
+	ioucmd->cmd = req->async_data;
 	return 0;
 }
 
@@ -129,9 +130,6 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)
 		WRITE_ONCE(ioucmd->cookie, NULL);
 	}
 
-	if (req_has_async_data(req))
-		ioucmd->cmd = req->async_data;
-
 	ret = file->f_op->uring_cmd(ioucmd, issue_flags);
 	if (ret == -EAGAIN) {
 		if (!req_has_async_data(req)) {

-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] io_uring/uring_cmd: assign ioucmd->cmd at async prep time
  2023-04-05 14:23 [PATCH] io_uring/uring_cmd: assign ioucmd->cmd at async prep time Jens Axboe
@ 2023-04-05 14:36 ` Gabriel Krisman Bertazi
  2023-04-05 15:29 ` Keith Busch
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gabriel Krisman Bertazi @ 2023-04-05 14:36 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Kanchan Joshi

Jens Axboe <[email protected]> writes:

> Rather than check this in the fast path issue, it makes more sense to
> just assign the copy of the data when we're setting it up anyway. This
> makes the code a bit cleaner, and removes the need for this check in
> the issue path.
>
> Signed-off-by: Jens Axboe <[email protected]>

Reviewed-by: Gabriel Krisman Bertazi <[email protected]>

-- 
Gabriel Krisman Bertazi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] io_uring/uring_cmd: assign ioucmd->cmd at async prep time
  2023-04-05 14:23 [PATCH] io_uring/uring_cmd: assign ioucmd->cmd at async prep time Jens Axboe
  2023-04-05 14:36 ` Gabriel Krisman Bertazi
@ 2023-04-05 15:29 ` Keith Busch
  2023-04-05 15:44 ` Anuj gupta
  2023-04-05 18:00 ` Kanchan Joshi
  3 siblings, 0 replies; 5+ messages in thread
From: Keith Busch @ 2023-04-05 15:29 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Kanchan Joshi

On Wed, Apr 05, 2023 at 08:23:15AM -0600, Jens Axboe wrote:
> Rather than check this in the fast path issue, it makes more sense to
> just assign the copy of the data when we're setting it up anyway. This
> makes the code a bit cleaner, and removes the need for this check in
> the issue path.

Looks good.

Reviewed-by: Keith Busch <[email protected]>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] io_uring/uring_cmd: assign ioucmd->cmd at async prep time
  2023-04-05 14:23 [PATCH] io_uring/uring_cmd: assign ioucmd->cmd at async prep time Jens Axboe
  2023-04-05 14:36 ` Gabriel Krisman Bertazi
  2023-04-05 15:29 ` Keith Busch
@ 2023-04-05 15:44 ` Anuj gupta
  2023-04-05 18:00 ` Kanchan Joshi
  3 siblings, 0 replies; 5+ messages in thread
From: Anuj gupta @ 2023-04-05 15:44 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Kanchan Joshi

On Wed, Apr 5, 2023 at 7:54 PM Jens Axboe <[email protected]> wrote:
>
> Rather than check this in the fast path issue, it makes more sense to
> just assign the copy of the data when we're setting it up anyway. This
> makes the code a bit cleaner, and removes the need for this check in
> the issue path.
>
> Signed-off-by: Jens Axboe <[email protected]>
>
> ---
>
> diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
> index 3d825d939b13..f7a96bc76ea1 100644
> --- a/io_uring/uring_cmd.c
> +++ b/io_uring/uring_cmd.c
> @@ -73,6 +73,7 @@ int io_uring_cmd_prep_async(struct io_kiocb *req)
>         cmd_size = uring_cmd_pdu_size(req->ctx->flags & IORING_SETUP_SQE128);
>
>         memcpy(req->async_data, ioucmd->cmd, cmd_size);
> +       ioucmd->cmd = req->async_data;
>         return 0;
>  }
>
> @@ -129,9 +130,6 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)
>                 WRITE_ONCE(ioucmd->cookie, NULL);
>         }
>
> -       if (req_has_async_data(req))
> -               ioucmd->cmd = req->async_data;
> -
>         ret = file->f_op->uring_cmd(ioucmd, issue_flags);
>         if (ret == -EAGAIN) {
>                 if (!req_has_async_data(req)) {
>
> --
> Jens Axboe
>

Looks good.

Reviewed-by: Anuj Gupta <[email protected]>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] io_uring/uring_cmd: assign ioucmd->cmd at async prep time
  2023-04-05 14:23 [PATCH] io_uring/uring_cmd: assign ioucmd->cmd at async prep time Jens Axboe
                   ` (2 preceding siblings ...)
  2023-04-05 15:44 ` Anuj gupta
@ 2023-04-05 18:00 ` Kanchan Joshi
  3 siblings, 0 replies; 5+ messages in thread
From: Kanchan Joshi @ 2023-04-05 18:00 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Kanchan Joshi

On Wed, Apr 5, 2023 at 7:54 PM Jens Axboe <[email protected]> wrote:
>
> Rather than check this in the fast path issue, it makes more sense to
> just assign the copy of the data when we're setting it up anyway. This
> makes the code a bit cleaner, and removes the need for this check in
> the issue path.

Reviewed-by: Kanchan Joshi <[email protected]>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-05 18:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-05 14:23 [PATCH] io_uring/uring_cmd: assign ioucmd->cmd at async prep time Jens Axboe
2023-04-05 14:36 ` Gabriel Krisman Bertazi
2023-04-05 15:29 ` Keith Busch
2023-04-05 15:44 ` Anuj gupta
2023-04-05 18:00 ` Kanchan Joshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox