From: Keith Busch <kbusch@meta.com>
To: <axboe@kernel.dk>, <io-uring@vger.kernel.org>
Cc: Keith Busch <kbusch@kernel.org>
Subject: [PATCH] liburing/io_passthrough: use metadata if format requires it
Date: Wed, 16 Apr 2025 09:28:02 -0700 [thread overview]
Message-ID: <20250416162802.3614051-1-kbusch@meta.com> (raw)
From: Keith Busch <kbusch@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
test/io_uring_passthrough.c | 16 ++++++++++++++++
test/nvme.h | 2 ++
2 files changed, 18 insertions(+)
diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c
index bea4f39..66c97da 100644
--- a/test/io_uring_passthrough.c
+++ b/test/io_uring_passthrough.c
@@ -17,6 +17,7 @@
#define BS 8192
#define BUFFERS (FILE_SIZE / BS)
+static void *meta_mem;
static struct iovec *vecs;
static int no_pt;
@@ -193,6 +194,12 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
cmd->addr = (__u64)(uintptr_t)&vecs[i];
cmd->data_len = 1;
}
+
+ if (meta_size) {
+ cmd->metadata = (__u64)(uintptr_t)(meta_mem +
+ meta_size * i * (nlb + 1));
+ cmd->metadata_len = meta_size * (nlb + 1);
+ }
cmd->nsid = nsid;
offset += BS;
@@ -404,6 +411,12 @@ static int test_io_uring_submit_enters(const char *file)
cmd->addr = (__u64)(uintptr_t)&vecs[i];
cmd->data_len = 1;
cmd->nsid = nsid;
+
+ if (meta_size) {
+ cmd->metadata = (__u64)(uintptr_t)(meta_mem +
+ meta_size * i * (nlb + 1));
+ cmd->metadata_len = meta_size * (nlb + 1);
+ }
}
/* submit manually to avoid adding IORING_ENTER_GETEVENTS */
@@ -451,6 +464,9 @@ int main(int argc, char *argv[])
return T_EXIT_SKIP;
vecs = t_create_buffers(BUFFERS, BS);
+ if (meta_size)
+ t_posix_memalign(&meta_mem, 0x1000,
+ meta_size * BUFFERS * (BS >> lba_shift));
for (i = 0; i < 32; i++) {
int read = (i & 1) != 0;
diff --git a/test/nvme.h b/test/nvme.h
index 1254b92..9c3cfa1 100644
--- a/test/nvme.h
+++ b/test/nvme.h
@@ -59,6 +59,7 @@ enum nvme_io_opcode {
static int nsid;
static __u32 lba_shift;
+static __u32 meta_size;
struct nvme_lbaf {
__le16 ms;
@@ -157,6 +158,7 @@ static int nvme_get_info(const char *file)
lba_size = 1 << ns.lbaf[(ns.flbas & 0x0f)].ds;
lba_shift = ilog2(lba_size);
+ meta_size = ns.lbaf[(ns.flbas & 0x0f)].ms;
close(fd);
return 0;
--
2.47.1
next reply other threads:[~2025-04-16 16:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250416162937epcas5p462a7895320769fbf9f5011c104def842@epcas5p4.samsung.com>
2025-04-16 16:28 ` Keith Busch [this message]
2025-04-17 14:51 ` [PATCH] liburing/io_passthrough: use metadata if format requires it Kanchan Joshi
2025-04-17 17:58 ` Jens Axboe
2025-04-18 4:47 ` Kanchan Joshi
2025-04-17 17:58 ` 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=20250416162802.3614051-1-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=kbusch@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