All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Cc: krisman@suse.de, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 1/2] io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout
Date: Thu, 23 Jan 2025 07:21:11 -0700	[thread overview]
Message-ID: <20250123142301.409846-2-axboe@kernel.dk> (raw)
In-Reply-To: <20250123142301.409846-1-axboe@kernel.dk>

A few spots in uring_cmd assume that the SQEs copied are always at the
start of the structure, and hence mix req->async_data and the struct
itself.

Clean that up and use the proper indices.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 io_uring/uring_cmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index 3993c9339ac7..6a63ec4b5445 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -192,8 +192,8 @@ static int io_uring_cmd_prep_setup(struct io_kiocb *req,
 		return 0;
 	}
 
-	memcpy(req->async_data, sqe, uring_sqe_size(req->ctx));
-	ioucmd->sqe = req->async_data;
+	memcpy(cache->sqes, sqe, uring_sqe_size(req->ctx));
+	ioucmd->sqe = cache->sqes;
 	return 0;
 }
 
@@ -260,7 +260,7 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)
 		struct io_uring_cmd_data *cache = req->async_data;
 
 		if (ioucmd->sqe != (void *) cache)
-			memcpy(cache, ioucmd->sqe, uring_sqe_size(req->ctx));
+			memcpy(cache->sqes, ioucmd->sqe, uring_sqe_size(req->ctx));
 		return -EAGAIN;
 	} else if (ret == -EIOCBQUEUED) {
 		return -EIOCBQUEUED;
-- 
2.47.2


  reply	other threads:[~2025-01-23 14:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 14:21 [PATCHSET 0/2] Cleanup alloc cache init_once handling Jens Axboe
2025-01-23 14:21 ` Jens Axboe [this message]
2025-01-23 14:38   ` [PATCH 1/2] io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout Pavel Begunkov
2025-01-23 14:54     ` Jens Axboe
2025-01-23 14:57       ` Pavel Begunkov
2025-01-23 14:58         ` Jens Axboe
2025-01-23 14:21 ` [PATCH 2/2] io_uring: get rid of alloc cache init_once handling Jens Axboe
2025-01-23 14:27   ` Pavel Begunkov
2025-01-23 14:47     ` Pavel Begunkov
2025-01-23 14:55       ` Jens Axboe
2025-01-23 15:05         ` Pavel Begunkov
2025-01-23 15:09           ` Jens Axboe
2025-01-23 14:54     ` 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=20250123142301.409846-2-axboe@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=krisman@suse.de \
    /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.