public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] liburing/io_passthrough: use metadata if format requires it
@ 2025-04-16 16:28 ` Keith Busch
  2025-04-17 14:51   ` Kanchan Joshi
  2025-04-17 17:58   ` Jens Axboe
  0 siblings, 2 replies; 5+ messages in thread
From: Keith Busch @ 2025-04-16 16:28 UTC (permalink / raw)
  To: axboe, io-uring; +Cc: Keith Busch

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


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

* Re: [PATCH] liburing/io_passthrough: use metadata if format requires it
  2025-04-16 16:28 ` [PATCH] liburing/io_passthrough: use metadata if format requires it Keith Busch
@ 2025-04-17 14:51   ` Kanchan Joshi
  2025-04-17 17:58     ` Jens Axboe
  2025-04-17 17:58   ` Jens Axboe
  1 sibling, 1 reply; 5+ messages in thread
From: Kanchan Joshi @ 2025-04-17 14:51 UTC (permalink / raw)
  To: Keith Busch, axboe, io-uring; +Cc: Keith Busch

The patch looks fine.
Just that it seems to have a conflict with the topmost patch [*] at this 
point.

[*] man: Fix syscall wrappers in example code


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

* Re: [PATCH] liburing/io_passthrough: use metadata if format requires it
  2025-04-17 14:51   ` Kanchan Joshi
@ 2025-04-17 17:58     ` Jens Axboe
  2025-04-18  4:47       ` Kanchan Joshi
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2025-04-17 17:58 UTC (permalink / raw)
  To: Kanchan Joshi, Keith Busch, io-uring; +Cc: Keith Busch

On 4/17/25 8:51 AM, Kanchan Joshi wrote:
> The patch looks fine.
> Just that it seems to have a conflict with the topmost patch [*] at this 
> point.
> 
> [*] man: Fix syscall wrappers in example code

Confused, there should be zero overlap between this patch and the
posted one?

-- 
Jens Axboe


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

* Re: [PATCH] liburing/io_passthrough: use metadata if format requires it
  2025-04-16 16:28 ` [PATCH] liburing/io_passthrough: use metadata if format requires it Keith Busch
  2025-04-17 14:51   ` Kanchan Joshi
@ 2025-04-17 17:58   ` Jens Axboe
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2025-04-17 17:58 UTC (permalink / raw)
  To: io-uring, Keith Busch; +Cc: Keith Busch


On Wed, 16 Apr 2025 09:28:02 -0700, Keith Busch wrote:
> 


Applied, thanks!

[1/1] liburing/io_passthrough: use metadata if format requires it
      commit: 60cf4969bd3eca3aba1fc24b6e0af7f92d155351

Best regards,
-- 
Jens Axboe




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

* Re: [PATCH] liburing/io_passthrough: use metadata if format requires it
  2025-04-17 17:58     ` Jens Axboe
@ 2025-04-18  4:47       ` Kanchan Joshi
  0 siblings, 0 replies; 5+ messages in thread
From: Kanchan Joshi @ 2025-04-18  4:47 UTC (permalink / raw)
  To: Jens Axboe, Keith Busch, io-uring; +Cc: Keith Busch

On 4/17/2025 11:28 PM, Jens Axboe wrote:
> Confused, there should be zero overlap between this patch and the
> posted one?

Since you are able to apply fine, I must have hallucinated. Sorry for 
the fuss.

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

end of thread, other threads:[~2025-04-18  4:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20250416162937epcas5p462a7895320769fbf9f5011c104def842@epcas5p4.samsung.com>
2025-04-16 16:28 ` [PATCH] liburing/io_passthrough: use metadata if format requires it Keith Busch
2025-04-17 14:51   ` Kanchan Joshi
2025-04-17 17:58     ` Jens Axboe
2025-04-18  4:47       ` Kanchan Joshi
2025-04-17 17:58   ` Jens Axboe

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