Skip to contentSkip to conversation

io_uring user metadata offset test

PATCH In review Keith Busch 4 participants 6 messages Nov 7, 2025 – Nov 19, 2025 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring user metadata offset test

From: Keith Busch <[email protected]>

For devices with metadata, tests various userspace offsets with io_uring capabilities. If the metadata is formatted with ref tag protection information, test various seed offsets as well.

---
 src/.gitignore      |   1 +
 src/Makefile        |   7 +-
 src/metadata.c      | 481 ++++++++++++++++++++++++++++++++++++++++++++
 tests/block/043     |  27 +++
 tests/block/043.out |   2 +
 5 files changed, 515 insertions(+), 3 deletions(-)
 create mode 100644 src/metadata.c
 create mode 100755 tests/block/043
 create mode 100644 tests/block/043.out
src/.gitignore +1 -0
index 865675c..e6c6c38 100644
@@ -3,6 +3,7 @@
 /loblksize
 /loop_change_fd
 /loop_get_status_null
+/metadata
 /mount_clear_sock
 /nbdsetsize
 /openclose
src/Makefile +4 -3
index 179a673..7146db0 100644
@@ -22,7 +22,8 @@ C_TARGETS := \
 	sg/syzkaller1 \
 	zbdioctl
 
-C_MINIUBLK := miniublk
+C_MINIUBLK := miniublk \
+		metadata
 
 HAVE_LIBURING := $(call HAVE_C_MACRO,liburing.h,IORING_OP_URING_CMD)
 HAVE_UBLK_HEADER := $(call HAVE_C_HEADER,linux/ublk_cmd.h,1)
@@ -61,8 +62,8 @@ $(C_TARGETS): %: %.c
 $(CXX_TARGETS): %: %.cpp
 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
 
-$(C_MINIUBLK): %: miniublk.c
-	$(CC) $(CFLAGS) $(LDFLAGS) $(MINIUBLK_FLAGS) -o $@ miniublk.c \
+$(C_MINIUBLK): %: %.c
+	$(CC) $(CFLAGS) $(LDFLAGS) $(MINIUBLK_FLAGS) -o $@ $^ \
 		$(MINIUBLK_LIBS)
 
 .PHONY: all clean install
src/metadata.c new file +481 -0

481 lines not on this page · raw message

tests/block/043 new file +27 -0
new file mode 100755
index 0000000..0e6a6cb
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+. tests/block/rc
+
+DESCRIPTION="Test userspace metadataoffsets"
+QUICK=1
+
+device_requires() {
+	_test_dev_has_metadata
+	_test_dev_disables_extended_lba
+}
+
+requires() {
+	_have_kernel_option IO_URING
+	_have_kernel_option BLK_DEV_INTEGRITY
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+
+	if ! src/metadata ${TEST_DEV}; then
+		echo "src/dio-offsets failed"
+	fi
+
+	echo "Test complete"
+}
+
tests/block/043.out new file +2 -0
new file mode 100644
index 0000000..fda7fca
@@ -0,0 +1,2 @@
+Running block/043
+Test complete
Signature · 1 line
2.47.3
#1 lore raw

tests/block/043 line 5

Quoted 11 lines · Keith Busch
tests/block/043 new file +5 -0
new file mode 100755
index 0000000..0e6a6cb
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+. tests/block/rc
+
+DESCRIPTION="Test userspace metadataoffsets"

nit:- DESCRIPTION="Test userspace metadata offsets" ? OR

"verify io_uring PI metadata integrity across buffer offsets" ?

tests/block/043 line 14

Quoted 9 lines
tests/block/043 new file +9 -0
+QUICK=1
+
+device_requires() {
+	_test_dev_has_metadata
+	_test_dev_disables_extended_lba
+}
+
+requires() {
+	_have_kernel_option IO_URING

this requires a specific kernel version or higher for IO_URING to have this metadata support ? OR any version of kernel would work ?

tests/block/043 line 15

Quoted 1 line
tests/block/043 new file +1 -0
+	_have_kernel_option BLK_DEV_INTEGRITY

looking at blktests, we need something like :-

common/rc +6 -0
index 86bb991..545da61 100644
@@ -226,6 +226,12 @@ _have_kernel_option() {
         return 0
  }
  
+_have_kernel_options() {
+      for opt in "$@"; do
+          _have_kernel_option "$opt" || return 1
+      done
+}
+
  # Compare the version string in $1 in "a.b.c" format with "$2.$3.$4".
  # If "a.b.c" is smaller than "$2.$3.$4", return true. Otherwise, return
  # false.

not asking you to do anything, I'll send a patch and remove these duplicates.

tests/block/043 line 22

Quoted 7 lines
tests/block/043 new file +7 -0
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+
+	if ! src/metadata ${TEST_DEV}; then
+		echo "src/dio-offsets failed"

nit:- echo "src/metadata failed" ?

tests/block/043.out line 1

Quoted 12 lines
tests/block/043 new file +5 -0
+	fi
+
+	echo "Test complete"
+}
+
tests/block/043.out new file +1 -0
new file mode 100644
index 0000000..fda7fca
@@ -0,0 +1,2 @@
+Running block/043

-ck

#2 lore raw
Quoted 5 lines · Chaitanya Kulkarni

On 11/7/25 15:18, Keith Busch wrote:

this requires a specific kernel version or higher for IO_URING to have this metadata support ? OR any version of kernel would work ?

It does require io_uring pi attributes, which was introduced in 6.13.

#3 lore raw
In reply to Keith Busch
Quoted 155 lines · Keith Busch

From: Keith Busch <[email protected]>

For devices with metadata, tests various userspace offsets with io_uring capabilities. If the metadata is formatted with ref tag protection information, test various seed offsets as well.

---
  src/.gitignore      |   1 +
  src/Makefile        |   7 +-
  src/metadata.c      | 481 ++++++++++++++++++++++++++++++++++++++++++++
  tests/block/043     |  27 +++
  tests/block/043.out |   2 +
  5 files changed, 515 insertions(+), 3 deletions(-)

create mode 100644 src/metadata.c
create mode 100755 tests/block/043
create mode 100644 tests/block/043.out

src/.gitignore +1 -0
index 865675c..e6c6c38 100644
@@ -3,6 +3,7 @@
  /loblksize
  /loop_change_fd
  /loop_get_status_null
+/metadata
  /mount_clear_sock
  /nbdsetsize
  /openclose
src/Makefile +4 -3
index 179a673..7146db0 100644
@@ -22,7 +22,8 @@ C_TARGETS := \
  	sg/syzkaller1 \
  	zbdioctl
 
-C_MINIUBLK := miniublk
+C_MINIUBLK := miniublk \
+		metadata
 
  HAVE_LIBURING := $(call HAVE_C_MACRO,liburing.h,IORING_OP_URING_CMD)
  HAVE_UBLK_HEADER := $(call HAVE_C_HEADER,linux/ublk_cmd.h,1)
@@ -61,8 +62,8 @@ $(C_TARGETS): %: %.c
  $(CXX_TARGETS): %: %.cpp
  	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
 
-$(C_MINIUBLK): %: miniublk.c
-	$(CC) $(CFLAGS) $(LDFLAGS) $(MINIUBLK_FLAGS) -o $@ miniublk.c \
+$(C_MINIUBLK): %: %.c
+	$(CC) $(CFLAGS) $(LDFLAGS) $(MINIUBLK_FLAGS) -o $@ $^ \
  		$(MINIUBLK_LIBS)
 
  .PHONY: all clean install
src/metadata.c new file +94 -0
new file mode 100644
index 0000000..4628299
@@ -0,0 +1,481 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Description: test userspace metadata
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <linux/fs.h>
+#include <liburing.h>
+
+#ifndef IORING_RW_ATTR_FLAG_PI
+#define PI_URING_COMPAT
+#define IORING_RW_ATTR_FLAG_PI  (1U << 0)
+/* PI attribute information */
+struct io_uring_attr_pi {
+	__u16   flags;
+	__u16   app_tag;
+	__u32   len;
+	__u64   addr;
+	__u64   seed;
+	__u64   rsvd;
+};
+#endif
+
+#ifndef FS_IOC_GETLBMD_CAP
+/* Protection info capability flags */
+#define LBMD_PI_CAP_INTEGRITY           (1 << 0)
+#define LBMD_PI_CAP_REFTAG              (1 << 1)
+
+/* Checksum types for Protection Information */
+#define LBMD_PI_CSUM_NONE               0
+#define LBMD_PI_CSUM_IP                 1
+#define LBMD_PI_CSUM_CRC16_T10DIF       2
+#define LBMD_PI_CSUM_CRC64_NVME         4
+
+/*
+ * Logical block metadata capability descriptor
+ * If the device does not support metadata, all the fields will be zero.
+ * Applications must check lbmd_flags to determine whether metadata is
+ * supported or not.
+ */
+struct logical_block_metadata_cap {
+	/* Bitmask of logical block metadata capability flags */
+	__u32	lbmd_flags;
+	/*
+	 * The amount of data described by each unit of logical block
+	 * metadata
+	 */
+	__u16	lbmd_interval;
+	/*
+	 * Size in bytes of the logical block metadata associated with each
+	 * interval
+	 */
+	__u8	lbmd_size;
+	/*
+	 * Size in bytes of the opaque block tag associated with each
+	 * interval
+	 */
+	__u8	lbmd_opaque_size;
+	/*
+	 * Offset in bytes of the opaque block tag within the logical block
+	 * metadata
+	 */
+	__u8	lbmd_opaque_offset;
+	/* Size in bytes of the T10 PI tuple associated with each interval */
+	__u8	lbmd_pi_size;
+	/* Offset in bytes of T10 PI tuple within the logical block metadata */
+	__u8	lbmd_pi_offset;
+	/* T10 PI guard tag type */
+	__u8	lbmd_guard_tag_type;
+	/* Size in bytes of the T10 PI application tag */
+	__u8	lbmd_app_tag_size;
+	/* Size in bytes of the T10 PI reference tag */
+	__u8	lbmd_ref_tag_size;
+	/* Size in bytes of the T10 PI storage tag */
+	__u8	lbmd_storage_tag_size;
+	__u8	pad;
+};
+
+#define FS_IOC_GETLBMD_CAP                      _IOWR(0x15, 2, struct logical_block_metadata_cap)
+#endif /* FS_IOC_GETLBMD_CAP */
+
+#ifndef IO_INTEGRITY_CHK_GUARD
+/* flags for integrity meta */
+#define IO_INTEGRITY_CHK_GUARD          (1U << 0) /* enforce guard check */
+#define IO_INTEGRITY_CHK_REFTAG         (1U << 1) /* enforce ref check */

src/metadata.c line 104

Quoted 10 lines
src/metadata.c new file +10 -0
+#define IO_INTEGRITY_CHK_APPTAG         (1U << 2) /* enforce app check */
+#endif /* IO_INTEGRITY_CHK_GUARD */
+
+/* This size should guarantee at least one split */
+#define DATA_SIZE (8 * 1024 * 1024)
+
+static unsigned short lba_size;
+static unsigned char metadata_size;
+static unsigned char pi_size;
+static unsigned char pi_offset;

nit:- do you really need above global duplication ? you can just declare struct logical_block_metadata_cap md_cap globally use md_cap.xxx ?

Quoted 14 lines
src/metadata.c new file +14 -0
+static bool reftag_enabled;
+
+static long pagesize;
+
+struct t10_pi_tuple {
+        __be16 guard_tag;       /* Checksum */
+        __be16 app_tag;         /* Opaque storage */
+        __be32 ref_tag;         /* Target LBA or indirect LBA */
+};
+
+struct crc64_pi_tuple {
+        __be64 guard_tag;
+        __be16 app_tag;
+        __u8   ref_tag[6];

src/metadata.c line 128

Quoted 10 lines
src/metadata.c new file +10 -0
+};
+
+static int init_capabilities(int fd)
+{
+	struct logical_block_metadata_cap md_cap;
+	int ret;
+
+	ret = ioctl(fd, FS_IOC_GETLBMD_CAP, &md_cap);
+	if (ret < 0)
+		return ret;

fprintf(stderr, "FS_IOC_GETLBMD_CAP failed: %s\n", strerror(errno)); ?

Quoted 140 lines
src/metadata.c new file +140 -0
+
+	lba_size = md_cap.lbmd_interval;
+	metadata_size = md_cap.lbmd_size;
+	pi_size = md_cap.lbmd_pi_size;
+	pi_offset = md_cap.lbmd_pi_offset;
+	reftag_enabled = md_cap.lbmd_flags & LBMD_PI_CAP_REFTAG;
+
+	pagesize = sysconf(_SC_PAGE_SIZE);
+	return 0;
+}
+
+static unsigned int swap(unsigned int value)
+{
+	return ((value >> 24) & 0x000000ff) |
+		((value >> 8)  & 0x0000ff00) |
+		((value << 8)  & 0x00ff0000) |
+		((value << 24) & 0xff000000);
+}
+
+static inline void __put_unaligned_be48(const __u64 val, __u8 *p)
+{
+	*p++ = (val >> 40) & 0xff;
+	*p++ = (val >> 32) & 0xff;
+	*p++ = (val >> 24) & 0xff;
+	*p++ = (val >> 16) & 0xff;
+	*p++ = (val >> 8) & 0xff;
+	*p++ = val & 0xff;
+}
+
+static inline void put_unaligned_be48(const __u64 val, void *p)
+{
+	__put_unaligned_be48(val, p);
+}
+
+static inline __u64 __get_unaligned_be48(const __u8 *p)
+{
+	return (__u64)p[0] << 40 | (__u64)p[1] << 32 | (__u64)p[2] << 24 |
+		p[3] << 16 | p[4] << 8 | p[5];
+}
+
+static inline __u64 get_unaligned_be48(const void *p)
+{
+	return __get_unaligned_be48(p);
+}
+
+static void init_metadata(void *p, int intervals, int ref)
+{
+	int i, j;
+
+	for (i = 0; i < intervals; i++, ref++) {
+		int remaining = metadata_size - pi_offset;
+		unsigned char *m = p;
+
+		for (j = 0; j < pi_offset; j++)
+			m[j] = (unsigned char)(ref + j + i);
+
+		p += pi_offset;
+		if (reftag_enabled) {
+			if (pi_size == 8) {
+				struct t10_pi_tuple *tuple = p;
+
+				tuple->ref_tag = swap(ref);
+				remaining -= sizeof(*tuple);
+				p += sizeof(*tuple);
+			} else if (pi_size == 16) {
+				struct crc64_pi_tuple *tuple = p;
+
+				__put_unaligned_be48(ref, tuple->ref_tag);
+				remaining -= sizeof(*tuple);
+				p += sizeof(*tuple);
+			}
+		}
+
+		m = p;
+		for (j = 0; j < remaining; j++)
+			m[j] = (unsigned char)~(ref + j + i);
+
+		p += remaining;
+	}
+}
+
+static int check_metadata(void *p, int intervals, int ref)
+{
+	int i, j;
+
+	for (i = 0; i < intervals; i++, ref++) {
+		int remaining = metadata_size - pi_offset;
+		unsigned char *m = p;
+
+		for (j = 0; j < pi_offset; j++) {
+			if (m[j] != (unsigned char)(ref + j + i)) {
+				fprintf(stderr, "(pre)interval:%d byte:%d expected:%x got:%x\n",
+					i, j, (unsigned char)(ref + j + i), m[j]);
+				return -1;
+			}
+		}
+
+		p += pi_offset;
+		if (reftag_enabled) {
+			if (pi_size == 8) {
+				struct t10_pi_tuple *tuple = p;
+
+				if (swap(tuple->ref_tag) != ref) {
+					fprintf(stderr, "reftag interval:%d expected:%x got:%x\n",
+						i, ref, swap(tuple->ref_tag));
+					return -1;
+				}
+
+				remaining -= sizeof(*tuple);
+				p += sizeof(*tuple);
+			} else if (pi_size == 16) {
+				struct crc64_pi_tuple *tuple = p;
+				__u64 v = get_unaligned_be48(tuple->ref_tag);
+
+				if (v != ref) {
+					fprintf(stderr, "reftag interval:%d expected:%x got:%llx\n",
+						i, ref, v);
+					return -1;
+				}
+				remaining -= sizeof(*tuple);
+				p += sizeof(*tuple);
+			}
+		}
+
+		m = p;
+		for (j = 0; j < remaining; j++) {
+			if (m[j] != (unsigned char)~(ref + j + i)) {
+				fprintf(stderr, "(post)interval:%d byte:%d expected:%x got:%x\n",
+					i, j, (unsigned char)~(ref + j + i), m[j]);
+				return -1;
+			}
+		}
+
+		p += remaining;
+	}
+
+	return 0;
+}
+
+static int init_data(void *data, int offset)

src/metadata.c line 278

Quoted 10 lines
src/metadata.c new file +10 -0
+{
+	unsigned char *d = data;
+	int i;
+
+	for (i = 0; i < DATA_SIZE; i++)
+		d[i] = (unsigned char)(0xaa + offset + i);
+
+	return 0;
+}
+

it should be :-

static int init_data(void *data, int offset)

{
	unsigned char *d = data;
	int i;

	for (i = 0; i < DATA_SIZE; i++)
		d[i] = (unsigned char)(0xaa + offset + i);

}

Quoted 50 lines
src/metadata.c new file +50 -0
+static int check_data(void *data, int offset)
+{
+	unsigned char *d = data;
+	int i;
+
+	for (i = 0; i < DATA_SIZE; i++)
+		if (d[i] != (unsigned char)(0xaa + offset + i))
+			return -1;
+
+	return 0;
+}
+
+int main(int argc, char *argv[])
+{
+	int fd, ret, offset, intervals, metabuffer_size, metabuffer_tx_size;
+	void *orig_data_buf, *orig_pi_buf, *data_buf;
+	struct io_uring_sqe *sqe;
+	struct io_uring_cqe *cqe;
+	struct io_uring ring;
+
+	if (argc < 2) {
+		fprintf(stderr, "Usage: %s <dev>\n", argv[0]);
+		return 1;
+	}
+
+	fd = open(argv[1], O_RDWR | O_DIRECT);
+	if (fd < 0) {
+		perror("Failed to open device with O_DIRECT");
+		return 1;
+	}
+
+	ret = init_capabilities(fd);
+	if (ret < 0)
+		return 1;
+	if (lba_size == 0 || metadata_size == 0)
+		return 1;
+
+	intervals = DATA_SIZE / lba_size;
+	metabuffer_tx_size = intervals * metadata_size;
+	metabuffer_size = metabuffer_tx_size * 2;
+
+	if (posix_memalign(&orig_data_buf, pagesize, DATA_SIZE)) {
+		perror("posix_memalign failed for data buffer");
+		ret = 1;
+		goto close;
+	}
+
+	if (posix_memalign(&orig_pi_buf, pagesize, metabuffer_size)) {
+		perror("posix_memalign failed for metadata buffer");
+		ret = 1;

src/metadata.c line 338

Quoted 10 lines
src/metadata.c new file +10 -0
+		goto free;
+	}
+
+	ret = io_uring_queue_init(8, &ring, 0);
+	if (ret < 0) {
+		perror("io_uring_queue_init failed");
+		goto cleanup;
+	}
+
+	data_buf = orig_data_buf;

both are not modified after above assignment till program exit why can't we just use one instead of both ?

-ck

#4 lore raw
In reply to Keith Busch
Quoted 7 lines · Keith Busch

From: Keith Busch <[email protected]>

For devices with metadata, tests various userspace offsets with io_uring capabilities. If the metadata is formatted with ref tag protection information, test various seed offsets as well.

Keith, thanks for this patch. Looks important.

Just for curiousity, is there any condition to make this test case fail? I ran the test case with v6.18-rc5 kernel and QEMU NVME device (mi=8), then it passed. Do we need specific hardware to make it fail?

If this test case just extends test coverage and no failure is expected at this point, I think it is still useful.

This patch added the test case block/043, skipping block/042. You posted the patch for block/042 last month [1], and it is not yet settled on the blktests master branch. Do you have plan to respin it? If so, I think this block/043 can be applied before the block/042 patch get applied. Otherwise, I will try to find out my time to improve your block/042 patch and settle.

[1] https://lore.kernel.org/linux-block/[email protected]/

Also, please find my some more comments in line.

Quoted 28 lines
---
 src/.gitignore      |   1 +
 src/Makefile        |   7 +-
 src/metadata.c      | 481 ++++++++++++++++++++++++++++++++++++++++++++
 tests/block/043     |  27 +++
 tests/block/043.out |   2 +
 5 files changed, 515 insertions(+), 3 deletions(-)
 create mode 100644 src/metadata.c
 create mode 100755 tests/block/043
 create mode 100644 tests/block/043.out
src/.gitignore +1 -0
index 865675c..e6c6c38 100644
@@ -3,6 +3,7 @@
 /loblksize
 /loop_change_fd
 /loop_get_status_null
+/metadata
 /mount_clear_sock
 /nbdsetsize
 /openclose
src/Makefile +0 -0
index 179a673..7146db0 100644

src/Makefile C_TARGETS := \ · line 26

Quoted 6 lines
src/Makefile +2 -1
@@ -22,7 +22,8 @@ C_TARGETS := \
 	sg/syzkaller1 \
 	zbdioctl
 
-C_MINIUBLK := miniublk
+C_MINIUBLK := miniublk \
+		metadata

Nit: After this change, C_MINIUBLK is no longer a good name. I suggest to rename it to C_URING_TARGETS. Other variables MINIUBLK_FLAGS and MINIUBLK_LIBS should be renamed to URING_FLAGS and URING_LIBS respectively. If you are too busy (I assume so), I can do these changes as a separated follow-up patch.

Quoted 20 lines
src/Makefile +2 -2
 HAVE_LIBURING := $(call HAVE_C_MACRO,liburing.h,IORING_OP_URING_CMD)
 HAVE_UBLK_HEADER := $(call HAVE_C_HEADER,linux/ublk_cmd.h,1)
@@ -61,8 +62,8 @@ $(C_TARGETS): %: %.c
 $(CXX_TARGETS): %: %.cpp
 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
 
-$(C_MINIUBLK): %: miniublk.c
-	$(CC) $(CFLAGS) $(LDFLAGS) $(MINIUBLK_FLAGS) -o $@ miniublk.c \
+$(C_MINIUBLK): %: %.c
+	$(CC) $(CFLAGS) $(LDFLAGS) $(MINIUBLK_FLAGS) -o $@ $^ \
 		$(MINIUBLK_LIBS)
 
 .PHONY: all clean install
src/metadata.c new file +0 -0
new file mode 100644
index 0000000..4628299

src/metadata.c line 1

Quoted 1 line
src/metadata.c new file +1 -0
@@ -0,0 +1,481 @@
+// SPDX-License-Identifier: GPL-2.0

Nit: GPL-2.0 is fine, but many of blktests files have GPL-3.0+. If there is no strong opinion, I suggest GPL-3.0+. Also, you may want to add copyright notice.

[...]

tests/block/043 line 1

Quoted 7 lines
tests/block/043 new file +1 -0
new file mode 100755
index 0000000..0e6a6cb
@@ -0,0 +1,27 @@
+#!/bin/bash

Even though this is a tiny script, I suggest to add a SPDX License Identifire, and your copyright here. Also, I suggest to add a short description here, copying from the commit message, like,

# Test various userspace offsets with io_uring capabilities. If the metadata is

# formatted with ref tag protection information, test various seed offsets as
# well.

tests/block/043 line 3

Quoted 2 lines
tests/block/043 new file +2 -0
+
+. tests/block/rc

". common/nvme" is required here, or the test run reports errors below:

tests/block/043: line 9: _test_dev_has_metadata: command not found tests/block/043: line 10: _test_dev_disables_extended_lba: command not found

Quoted 9 lines
tests/block/043 new file +9 -0
+
+DESCRIPTION="Test userspace metadataoffsets"
+QUICK=1
+
+device_requires() {
+	_test_dev_has_metadata
+	_test_dev_disables_extended_lba
+}
+

tests/block/043 line 22

Quoted 10 lines
tests/block/043 new file +10 -0
+requires() {
+	_have_kernel_option IO_URING
+	_have_kernel_option BLK_DEV_INTEGRITY
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+
+	if ! src/metadata ${TEST_DEV}; then
+		echo "src/dio-offsets failed"

As Chaitanya noted, it should be "src/metadata failed".

Quoted 16 lines
tests/block/043 new file +5 -0
+	fi
+
+	echo "Test complete"
+}
+
tests/block/043.out new file +2 -0
new file mode 100644
index 0000000..fda7fca
@@ -0,0 +1,2 @@
+Running block/043
+Test complete
Signature · 1 line
2.47.3
#5 lore raw
Quoted 9 lines · Shinichiro Kawasaki
Quoted 7 lines · Keith Busch

From: Keith Busch <[email protected]>

For devices with metadata, tests various userspace offsets with io_uring capabilities. If the metadata is formatted with ref tag protection information, test various seed offsets as well.

Quoted 8 lines

Keith, thanks for this patch. Looks important.

Just for curiousity, is there any condition to make this test case fail? I ran the test case with v6.18-rc5 kernel and QEMU NVME device (mi=8), then it passed. Do we need specific hardware to make it fail?

If this test case just extends test coverage and no failure is expected at this point, I think it is still useful.

It's not supposed to fail for any format. The test queries the capabilities of the device and reacts accordingly. This test will send various alignments and lengths that span page boundaries, and the kernel will use it directly if the hardware supports that, or bounce it if not.

Quoted 5 lines

This patch added the test case block/043, skipping block/042. You posted the patch for block/042 last month [1], and it is not yet settled on the blktests master branch. Do you have plan to respin it? If so, I think this block/043 can be applied before the block/042 patch get applied. Otherwise, I will try to find out my time to improve your block/042 patch and settle.

Yes, I'm working on a respin for 042 right now.