Skip to contentSkip to conversation

verify pattern interval

PATCH In review Vincent Fu 2 participants 15 messages May 8, 2025 – May 16, 2025

lore
Share & tools
lore

Vincent Fu

author
#0 lore raw

cover verify pattern interval

This patch series adds the verify_pattern_interval option which refreshes and restarts the verify_pattern every N bytes. This is intended to be used when verify_pattern contains the %o format specifier in order to write each offset with its LBA. Doing this 512 bytes at a time for a large device is slow, so verify_pattern_interval allows fio to write this pattern in larger chunks.

Patch 1 makes testing easier by adding a verify=pattern_hdr option. Patches 2-3 fix two bugs found while testing the new feature. Patch 4 directs fio to omit an inappropriate error message. Patches 5-7 improve testing.
Patch 8 implements this new feature.
Patches 9-11 add tests to verify the new feature.

Vincent Fu (11):
verify: add verify mode for a pattern with header
verify: fix verify_offset when used with pattern_hdr
verify: make verify_pattern=%o thread safe
verify: omit verify type mismatch error message for pattern verify t/fiotestcommon: lengthen timeout for longer tests
ci: for nightly verify tests use all checksum methods
ci: don't skip verify tests when triggered manually
verify: add verify_pattern_interval option
t/verify: test cases for running pattern and pattern_hdr t/verify: Windows --output work-around
t/verify: add tests to exercise verify_pattern_interval

 HOWTO.rst               |  11 +++
 cconv.c                 |   2 +
 ci/actions-full-test.sh |   9 ++-
 fio.1                   |  10 +++
 options.c               |  16 ++++
 server.h                |   2 +-
 t/fiotestcommon.py      |   2 +-
 t/verify.py             | 123 ++++++++++++++++++++++++++++++-
 thread_options.h        |   3 +
 verify.c                | 158 ++++++++++++++++++++++++++++++++--------
 10 files changed, 295 insertions(+), 41 deletions(-)
Signature · 1 line
2.47.2
author
#1 lore raw

PATCH 1/11 verify: add verify mode for a pattern with header

Add a verify=pattern_hdr option. Previously this was only available when verify_pattern was set and verify= was omitted. Add a means to explicitly select this verificaiton mode.

This is useful in the t/verify.py test script because it's troublesome to have some jobs with a verify= option and omit this option in other jobs when we want to test pattern verification with a header.

---
 HOWTO.rst | 3 +++
 fio.1     | 3 +++
 options.c | 4 ++++
 3 files changed, 10 insertions(+)
HOWTO.rst +3 -0
index a5033d82..78a259ef 100644
@@ -3921,6 +3921,9 @@ Verification
 			basic information and checksumming, but if this option is set, only
 			the specific pattern set with :option:`verify_pattern` is verified.
 
+		**pattern_hdr**
+			Verify a pattern in conjunction with a header.
+
 		**null**
 			Only pretend to verify. Useful for testing internals with
 			:option:`ioengine`\=null, not for much else.
fio.1 +3 -0
index 8476b681..d6ee4193 100644
@@ -3641,6 +3641,9 @@ Verify a strict pattern. Normally fio includes a header with some
 basic information and checksumming, but if this option is set, only
 the specific pattern set with \fBverify_pattern\fR is verified.
 .TP
+.B pattern_hdr
+Verify a pattern in conjunction with a header.
+.TP
 .B null
 Only pretend to verify. Useful for testing internals with
 `ioengine=null', not for much else.
options.c +4 -0
index 71c97e9e..28ffc748 100644
@@ -3217,6 +3217,10 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
 			    .oval = VERIFY_PATTERN_NO_HDR,
 			    .help = "Verify strict pattern",
 			  },
+			  { .ival = "pattern_hdr",
+			    .oval = VERIFY_PATTERN,
+			    .help = "Verify pattern with header",
+			  },
 			  {
 			    .ival = "null",
 			    .oval = VERIFY_NULL,
Signature · 1 line
2.47.2
author
#2 lore raw

PATCH 2/11 verify: fix verify_offset when used with pattern_hdr

In reply to Vincent Fu

When using verify=pattern_hdr with verify_offset, we cannot reuse the data already in a buffer because some of the pattern bytes have been swapped with the verify header. Trying to reuse the buffer contents just results in the header being swapped back and forth between the verify_offset location and the beginning of the verify_interval.

Fix this by avoiding reuse of buffer contents.

Failing test case example:

root@localhost:~/fio-dev/fio-canonical# ./fio --name=verify --filesize=8192 --verify_offset=1024 --verify_pattern=1 --rw=write
verify: (g=0): rw=write, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
fio-3.39-38-gf18c
Starting 1 process
fio: got pattern 'ca', wanted '01'. Bad bits 5
fio: bad pattern block offset 1024
pattern: verify failed at file verify.0.0 offset 4096, length 4096 (requested block: offset=4096, length=4096, flags=88)
fio: pid=3624903, err=84/file:io_u.c:2258, func=io_u_sync_complete, error=Invalid or incomplete multibyte or wide character

verify: (groupid=0, jobs=1): err=84 (file:io_u.c:2258, func=io_u_sync_complete, error=Invalid or incomplete multibyte or wide character): pid=3624903: Fri Apr 11 22:56:01 2025
read: IOPS=2000, BW=8000KiB/s (8192kB/s)(8192B/1msec)

    clat (nsec): min=2185, max=15807, avg=8996.00, stdev=9632.21
     lat (nsec): min=2280, max=16120, avg=9200.00, stdev=9786.36
    clat percentiles (nsec):
     |  1.00th=[ 2192],  5.00th=[ 2192], 10.00th=[ 2192], 20.00th=[ 2192],
     | 30.00th=[ 2192], 40.00th=[ 2192], 50.00th=[ 2192], 60.00th=[15808],
     | 70.00th=[15808], 80.00th=[15808], 90.00th=[15808], 95.00th=[15808],
     | 99.00th=[15808], 99.50th=[15808], 99.90th=[15808], 99.95th=[15808],
     | 99.99th=[15808]
  write: IOPS=2000, BW=8000KiB/s (8192kB/s)(8192B/1msec); 0 zone resets
    clat (nsec): min=7910, max=82940, avg=45425.00, stdev=53054.22
     lat (usec): min=9, max=100, avg=55.03, stdev=64.49
    clat percentiles (nsec):
     |  1.00th=[ 7904],  5.00th=[ 7904], 10.00th=[ 7904], 20.00th=[ 7904],
     | 30.00th=[ 7904], 40.00th=[ 7904], 50.00th=[ 7904], 60.00th=[82432],
     | 70.00th=[82432], 80.00th=[82432], 90.00th=[82432], 95.00th=[82432],
     | 99.00th=[82432], 99.50th=[82432], 99.90th=[82432], 99.95th=[82432],
     | 99.99th=[82432]
  lat (usec)   : 4=25.00%, 10=25.00%, 20=25.00%, 100=25.00%
  cpu          : usr=0.00%, sys=0.00%, ctx=0, majf=0, minf=19
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=20.0%, 4=80.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=2,2,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
READ: bw=8000KiB/s (8192kB/s), 8000KiB/s-8000KiB/s (8192kB/s-8192kB/s), io=8192B (8192B), run=1-1msec
WRITE: bw=8000KiB/s (8192kB/s), 8000KiB/s-8000KiB/s (8192kB/s-8192kB/s), io=8192B (8192B), run=1-1msec

Disk stats (read/write):
sda: ios=0/0, sectors=0/0, merge=0/0, ticks=0/0, in_queue=0, util=0.00%

---
 verify.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
verify.c +4 -3
index 928bdd54..e7e619d3 100644
@@ -65,9 +65,10 @@ void fill_verify_pattern(struct thread_data *td, void *p, unsigned int len,
 		return;
 	}
 
-	/* Skip if we were here and we do not need to patch pattern
-	 * with format */
-	if (!td->o.verify_fmt_sz && io_u->buf_filled_len >= len) {
+	/* Skip if we were here and we do not need to patch pattern with
+	 * format. However, we cannot skip if verify_offset is set because we
+	 * have swapped the header with pattern bytes */
+	if (!td->o.verify_fmt_sz && io_u->buf_filled_len >= len && !td->o.verify_offset) {
 		dprint(FD_VERIFY, "using already filled verify pattern b=%d len=%u\n",
 			o->verify_pattern_bytes, len);
 		return;
Signature · 1 line
2.47.2
author
#3 lore raw

PATCH 3/11 verify: make verify_pattern=%o thread safe

In reply to Vincent Fu

When verify_async is set, multiple threads create instances of the verify_pattern in the same buffer. This is not a problem if the pattern is a constant value. However, if the pattern depends on the offset then pattern verification will produce false failures.

This patch changes verify_io_u_pattern() to allocate brand new buffers to instantiate the verify_pattern when verify_pattern contains the %o format specifier and verify_async is set. With each thread having its own pattern buffer they will no longer interfere with each other.

Failing use case example:

root@localhost:~/fio-dev/fio-canonical# ./fio --name=test --ioengine=io_uring --iodepth=32 --filesize=256k --verify_pattern=%o --verify_async=2 --rw=write
test: (g=0): rw=write, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=io_uring, iodepth=32
fio-3.39-44-g19d9
Starting 1 process
fio: got pattern '10', wanted '70'. Bad bits 2
fio: bad pattern block offset 41
pattern: verify failed at file test.0.0 offset 200704, length 4096 (requested block: offset=200704, length=4096, flags=84)

test: (groupid=0, jobs=1): err= 0: pid=3972816: Tue Apr 22 16:59:55 2025
read: IOPS=21.3k, BW=83.3MiB/s (87.4MB/s)(256KiB/3msec)

    slat (nsec): min=3989, max=35487, avg=5319.23, stdev=4033.94
    clat (usec): min=43, max=2008, avg=1058.31, stdev=513.19
     lat (usec): min=47, max=2012, avg=1063.63, stdev=512.36
    clat percentiles (usec):
     |  1.00th=[   44],  5.00th=[  178], 10.00th=[  347], 20.00th=[  570],
     | 30.00th=[  775], 40.00th=[  930], 50.00th=[ 1074], 60.00th=[ 1237],
     | 70.00th=[ 1385], 80.00th=[ 1532], 90.00th=[ 1729], 95.00th=[ 1811],
     | 99.00th=[ 2008], 99.50th=[ 2008], 99.90th=[ 2008], 99.95th=[ 2008],
     | 99.99th=[ 2008]
  write: IOPS=32.0k, BW=125MiB/s (131MB/s)(256KiB/2msec); 0 zone resets
    slat (usec): min=2, max=328, avg= 9.50, stdev=40.93
    clat (usec): min=250, max=585, avg=382.74, stdev=86.17
     lat (usec): min=262, max=588, avg=392.24, stdev=88.98
    clat percentiles (usec):
     |  1.00th=[  251],  5.00th=[  262], 10.00th=[  293], 20.00th=[  306],
     | 30.00th=[  330], 40.00th=[  334], 50.00th=[  359], 60.00th=[  404],
     | 70.00th=[  416], 80.00th=[  474], 90.00th=[  494], 95.00th=[  545],
     | 99.00th=[  586], 99.50th=[  586], 99.90th=[  586], 99.95th=[  586],
     | 99.99th=[  586]
  lat (usec)   : 50=0.78%, 100=0.78%, 250=2.34%, 500=50.78%, 750=9.38%
  lat (usec)   : 1000=8.59%
  lat (msec)   : 2=26.56%, 4=0.78%
  cpu          : usr=0.00%, sys=50.00%, ctx=54, majf=0, minf=15
  IO depths    : 1=1.6%, 2=3.1%, 4=6.2%, 8=12.5%, 16=25.0%, 32=51.6%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=97.1%, 8=0.0%, 16=0.0%, 32=2.9%, 64=0.0%, >=64=0.0%
     issued rwts: total=64,64,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=32

Run status group 0 (all jobs):
READ: bw=83.3MiB/s (87.4MB/s), 83.3MiB/s-83.3MiB/s (87.4MB/s-87.4MB/s), io=256KiB (262kB), run=3-3msec
WRITE: bw=125MiB/s (131MB/s), 125MiB/s-125MiB/s (131MB/s-131MB/s), io=256KiB (262kB), run=2-2msec

Disk stats (read/write):
sda: ios=0/0, sectors=0/0, merge=0/0, ticks=0/0, in_queue=0, util=0.00%

---
 verify.c | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)
verify.c +31 -5
index e7e619d3..c90c008c 100644
@@ -373,6 +373,20 @@ static inline void *io_u_verify_off(struct verify_header *hdr, struct vcont *vc)
 	return vc->io_u->buf + vc->hdr_num * hdr->len + hdr_size(vc->td, hdr);
 }
 
+/*
+ *  The current thread will need its own buffer if there are multiple threads
+ *  and the pattern contains the offset. Fio currently only has one pattern
+ *  format specifier so we only need to check that one, but this may need to be
+ *  changed if fio ever gains more pattern format specifiers.
+ */
+static inline bool pattern_need_buffer(struct thread_data *td)
+{
+	return td->o.verify_async &&
+		td->o.verify_fmt_sz &&
+		td->o.verify_fmt[0].desc->paste == paste_blockoff;
+}
+
+
 static int verify_io_u_pattern(struct verify_header *hdr, struct vcont *vc)
 {
 	struct thread_data *td = vc->td;
@@ -386,6 +400,16 @@ static int verify_io_u_pattern(struct verify_header *hdr, struct vcont *vc)
 	pattern_size = td->o.verify_pattern_bytes;
 	assert(pattern_size != 0);
 
+	/*
+	 * Make this thread safe when verify_async is set and the verify
+	 * pattern includes the offset.
+	 */
+	if (pattern_need_buffer(td)) {
+		pattern = malloc(pattern_size);
+		assert(pattern);
+		memcpy(pattern, td->o.verify_pattern, pattern_size);
+	}
+
 	(void)paste_format_inplace(pattern, pattern_size,
 				   td->o.verify_fmt, td->o.verify_fmt_sz, io_u);
 
@@ -395,7 +419,7 @@ static int verify_io_u_pattern(struct verify_header *hdr, struct vcont *vc)
 
 	rc = cmp_pattern(pattern, pattern_size, mod, buf, len);
 	if (!rc)
-		return 0;
+		goto done;
 
 	/* Slow path, compare each byte */
 	for (i = 0; i < len; i++) {
@@ -411,16 +435,18 @@ static int verify_io_u_pattern(struct verify_header *hdr, struct vcont *vc)
 				i + header_size);
 			vc->name = "pattern";
 			log_verify_failure(hdr, vc);
-			return EILSEQ;
+			rc = EILSEQ;
+			goto done;
 		}
 		mod++;
 		if (mod == td->o.verify_pattern_bytes)
 			mod = 0;
 	}
 
-	/* Unreachable line */
-	assert(0);
-	return EILSEQ;
+done:
+	if (pattern_need_buffer(td))
+		free(pattern);
+	return rc;
 }
 
 static int verify_io_u_xxhash(struct verify_header *hdr, struct vcont *vc)
Signature · 1 line
2.47.2
author
#4 lore raw

PATCH 4/11 verify: omit verify type mismatch error message for pattern verify

In reply to Vincent Fu

When we are carrying out pattern verification without a header we should not print out an error message about a verify type mismatch because there is no header on the media specifying the verify type.

---
 verify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
verify.c +1 -1
index c90c008c..cffe5999 100644
@@ -1031,7 +1031,7 @@ int verify_io_u(struct thread_data *td, struct io_u **io_u_ptr)
 			ret = EINVAL;
 		}
 
-		if (ret && verify_type != hdr->verify_type)
+		if (ret && verify_type != hdr->verify_type && verify_type != VERIFY_PATTERN_NO_HDR)
 			log_err("fio: verify type mismatch (%u media, %u given)\n",
 					hdr->verify_type, verify_type);
 	}
Signature · 1 line
2.47.2
author
#5 lore raw

PATCH 5/11 t/fiotestcommon: lengthen timeout for longer tests

In reply to Vincent Fu

For GitHub-hosted Windows runners t/verify.py runs for longer than 30 min when it tests all checksum methods. Make the timeout for SUCESS_LONG tests 1hr to accommodate these tests.

---
 t/fiotestcommon.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/fiotestcommon.py +1 -1
index 9003b4c1..04dfb91f 100644
@@ -22,7 +22,7 @@ SUCCESS_DEFAULT = {
 SUCCESS_LONG = {
     'zero_return': True,
     'stderr_empty': True,
-    'timeout': 1800,
+    'timeout': 3600,
     }
 SUCCESS_NONZERO = {
     'zero_return': False,
Signature · 1 line
2.47.2
author
#6 lore raw

PATCH 6/11 ci: for nightly verify tests use all checksum methods

In reply to Vincent Fu

By default t/verify.py runs tests with only a small selection of checksum methods. Run the test script with an option so that our nightly tests use all of the checksum methods.

---
 ci/actions-full-test.sh | 2 ++
 1 file changed, 2 insertions(+)
ci/actions-full-test.sh +2 -0
index 4222a21a..6ff13c4d 100755
@@ -41,6 +41,8 @@ main() {
 	args+=(
 	    --run-only
 	    1017
+	    -p
+	    "1017:--complete"
 	)
     else
 	skip+=(
Signature · 1 line
2.47.2
author
#7 lore raw

PATCH 7/11 ci: don't skip verify tests when triggered manually

In reply to Vincent Fu

When our test suite is triggered manually it skips the verify test script. Change this so that the verify test script is run when the tests are manually kicked off. This is accomplished by skipping the verify test suite only when a push or pull request triggers our tests.

With this change we don't have to wait overnight to see the results of the verify tests.

---
 ci/actions-full-test.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
ci/actions-full-test.sh +4 -3
index 6ff13c4d..6fa9f4ad 100755
@@ -35,8 +35,9 @@ main() {
 
     fi
 
-    # If we are running a nightly test just run the verify tests.
-    # Otherwise skip the verify test script because it takes so long.
+    # If we are running a nightly test just run the verify tests.  Skip the
+    # verify test script with pull requests and pushes because it takes so
+    # long. When this workflow is run manually everything will be run.
     if [ "${GITHUB_EVENT_NAME}" == "schedule" ]; then
 	args+=(
 	    --run-only
@@ -44,7 +45,7 @@ main() {
 	    -p
 	    "1017:--complete"
 	)
-    else
+    elif [ "${GITHUB_EVENT_NAME}" == "pull_request" ] || [ "${GITHUB_EVENT_NAME}" == "push" ]; then
 	skip+=(
 	    1017
 	)
Signature · 1 line
2.47.2
author
#8 lore raw

PATCH 8/11 verify: add verify_pattern_interval option

In reply to Vincent Fu

It can be useful to fill a device by writing each LBA with its offset using a verify_pattern value that includes the %o format specifier. However, it is slow to do this 512B at a time for a large device. This patch adds the verify_pattern_interval option to enable fio to write such a data pattern using larger transfer sizes. With this option set, fio will update the offset every verify_pattern_interval bytes. For a 4096-byte block with verify_pattern=%o the first 512 bytes will be 0, the second 512 bytes will be 512, the third 512 bytes will be 1024, etc when verify_pattern_interval=512.

When verify_pattern does not include %o the verify_pattern_interval option will still re-start the verify pattern eveny N bytes.

---
 HOWTO.rst        |   8 +++
 cconv.c          |   2 +
 fio.1            |   7 +++
 options.c        |  12 +++++
 server.h         |   2 +-
 thread_options.h |   3 ++
 verify.c         | 125 ++++++++++++++++++++++++++++++++++++-----------
 7 files changed, 129 insertions(+), 30 deletions(-)
HOWTO.rst +8 -0
index 78a259ef..f082158a 100644
@@ -3977,6 +3977,14 @@ Verification
 
 		verify_pattern=0xff%o"abcd"-12
 
+.. option:: verify_pattern_interval=bool
+
+        Recreate an instance of the :option:`verify_pattern` every
+        :option:`verify_pattern_interval` bytes. This is only useful when
+        :option:`verify_pattern` contains the %o format specifier and can be
+        used to speed up the process of writing each block on a device with its
+        offset. Default: 0 (disabled).
+
 .. option:: verify_fatal=bool
 
 	Normally fio will keep checking the entire contents before quitting on a
cconv.c +2 -0
index cc1a52c7..d2faf83e 100644
@@ -186,6 +186,7 @@ int convert_thread_options_to_cpu(struct thread_options *o,
 	o->verify_header_seed = le32_to_cpu(top->verify_header_seed);
 
 	o->verify_pattern_bytes = le32_to_cpu(top->verify_pattern_bytes);
+	o->verify_pattern_interval = le32_to_cpu(top->verify_pattern_interval);
 	o->buffer_pattern_bytes = le32_to_cpu(top->buffer_pattern_bytes);
 	if (o->verify_pattern_bytes >= MAX_PATTERN_SIZE ||
 	    o->buffer_pattern_bytes >= MAX_PATTERN_SIZE ||
@@ -448,6 +449,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
 	top->verify_write_sequence = cpu_to_le32(o->verify_write_sequence);
 	top->verify_header_seed = cpu_to_le32(o->verify_header_seed);
 	top->verify_pattern_bytes = cpu_to_le32(o->verify_pattern_bytes);
+	top->verify_pattern_interval = cpu_to_le32(o->verify_pattern_interval);
 	top->verify_fatal = cpu_to_le32(o->verify_fatal);
 	top->verify_dump = cpu_to_le32(o->verify_dump);
 	top->verify_async = cpu_to_le32(o->verify_async);
fio.1 +7 -0
index d6ee4193..f7141e75 100644
@@ -3701,6 +3701,13 @@ verify_pattern=0xff%o"abcd"\-12
 .RE
 .RE
 .TP
+.BI verify_pattern_interval \fR=\fPbool
+Recreate an instance of the \fBverify_pattern\fR every
+\fBverify_pattern_interval\fR bytes. This is only useful when
+\fBverify_pattern\fR contains the %o format specifier and can be used to speed
+up the process of writing each block on a device with its offset. Default:
+0 (disabled).
+.TP
 .BI verify_fatal \fR=\fPbool
 Normally fio will keep checking the entire contents before quitting on a
 block verification failure. If this option is set, fio will exit the job on
options.c +12 -0
index 28ffc748..cfece3fe 100644
@@ -3291,6 +3291,18 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
 		.category = FIO_OPT_C_IO,
 		.group	= FIO_OPT_G_VERIFY,
 	},
+	{
+		.name	= "verify_pattern_interval",
+		.lname	= "Running verify pattern",
+		.type	= FIO_OPT_INT,
+		.off1	= offsetof(struct thread_options, verify_pattern_interval),
+		.def	= "0",
+		.help	= "Re-create verify pattern every N bytes",
+		.parent = "verify",
+		.hide	= 1,
+		.category = FIO_OPT_C_IO,
+		.group	= FIO_OPT_G_VERIFY,
+	},
 	{
 		.name	= "verify_fatal",
 		.lname	= "Verify fatal",
server.h +1 -1
index 0b93cd02..713fd8e4 100644
@@ -51,7 +51,7 @@ struct fio_net_cmd_reply {
 };
 
 enum {
-	FIO_SERVER_VER			= 110,
+	FIO_SERVER_VER			= 111,
 
 	FIO_SERVER_MAX_FRAGMENT_PDU	= 1024,
 	FIO_SERVER_MAX_CMD_MB		= 2048,
thread_options.h +3 -0
index b0094651..6c9dd80a 100644
@@ -146,6 +146,7 @@ struct thread_options {
 	unsigned int verify_offset;
 	char *verify_pattern;
 	unsigned int verify_pattern_bytes;
+	unsigned int verify_pattern_interval;
 	struct pattern_fmt verify_fmt[8];
 	unsigned int verify_fmt_sz;
 	unsigned int verify_fatal;
@@ -478,6 +479,7 @@ struct thread_options_pack {
 	uint32_t verify_interval;
 	uint32_t verify_offset;
 	uint32_t verify_pattern_bytes;
+	uint32_t verify_pattern_interval;
 	uint32_t verify_fatal;
 	uint32_t verify_dump;
 	uint32_t verify_async;
@@ -517,6 +519,7 @@ struct thread_options_pack {
 
 	struct zone_split zone_split[DDIR_RWDIR_CNT][ZONESPLIT_MAX];
 	uint32_t zone_split_nr[DDIR_RWDIR_CNT];
+	uint32_t pad2;
 
 	fio_fp64_t zipf_theta;
 	fio_fp64_t pareto_h;
verify.c +96 -29

173 lines not on this page · raw message

Signature · 1 line
2.47.2
author
#9 lore raw

PATCH 9/11 t/verify: test cases for running pattern and pattern_hdr

In reply to Vincent Fu

Add test cases for the recently added verify_pattern_interval and verify=pattern_hdr options to our pre-existing sets of tests.

In some cases verify failures do not produce non-zero return values unless verify_fatal is set. Add verify_fatal=1 to affected test cases.

---
 t/verify.py | 45 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)
t/verify.py +42 -3
index e48bad28..8f0cb1ef 100755
@@ -55,7 +55,9 @@ VERIFY_OPT_LIST = [
     'verify_async',
     'verify_async_cpus',
     'verify_pattern',
+    'verify_pattern_interval',
     'verify_only',
+    'verify_fatal',
 ]
 
 class VerifyTest(FioJobCmdTest):
@@ -281,6 +283,7 @@ TEST_LIST_CSUM = [
             "bs": 4096,
             "rw": "write",
             "output-format": "json",
+            "verify_fatal": 1,
             },
         "test_class": VerifyCSUMTest,
         "success": SUCCESS_NONZERO,
@@ -294,6 +297,7 @@ TEST_LIST_CSUM = [
             "bs": 4096,
             "rw": "randwrite",
             "output-format": "json",
+            "verify_fatal": 1,
             },
         "test_class": VerifyCSUMTest,
         "success": SUCCESS_NONZERO,
@@ -309,6 +313,7 @@ TEST_LIST_CSUM = [
             "bs": 4096,
             "rw": "write",
             "output-format": "json",
+            "verify_fatal": 1,
             },
         "test_class": VerifyCSUMTest,
         "success": SUCCESS_NONZERO,
@@ -324,6 +329,7 @@ TEST_LIST_CSUM = [
             "bs": 4096,
             "rw": "randwrite",
             "output-format": "json",
+            "verify_fatal": 1,
             },
         "test_class": VerifyCSUMTest,
         "success": SUCCESS_NONZERO,
@@ -508,10 +514,20 @@ def verify_test_header(test_env, args, csum, mode, sequence):
             test['force_skip'] = False
 
         test['fio_opts']['verify'] = csum
-        if csum == 'pattern':
+        if csum in ('pattern', 'pattern_hdr'):
             test['fio_opts']['verify_pattern'] = '"abcd"-120xdeadface'
+            test['fio_opts'].pop('verify_pattern_interval', None)
+        elif csum == 'pattern_interval':
+            test['fio_opts']['verify'] = "pattern_hdr"
+            test['fio_opts']['verify_pattern'] = '%o'
+            test['fio_opts']['verify_pattern_interval'] = 512
+        elif csum == 'pattern_interval_nohdr':
+            test['fio_opts']['verify'] = "pattern"
+            test['fio_opts']['verify_pattern'] = '%o'
+            test['fio_opts']['verify_pattern_interval'] = 512
         else:
             test['fio_opts'].pop('verify_pattern', None)
+            test['fio_opts'].pop('verify_pattern_interval', None)
 
         if 'norandommap' in sequence:
             test['fio_opts']['norandommap'] = 1
@@ -579,10 +595,20 @@ def verify_test_csum(test_env, args, mbs, csum):
         test['force_skip'] = False
         test['fio_opts']['verify'] = csum
 
-        if csum == 'pattern':
+        if csum in ('pattern', 'pattern_hdr'):
             test['fio_opts']['verify_pattern'] = '"abcd"-120xdeadface'
+            test['fio_opts'].pop('verify_pattern_interval', None)
+        elif csum == 'pattern_interval':
+            test['fio_opts']['verify'] = "pattern_hdr"
+            test['fio_opts']['verify_pattern'] = '%o'
+            test['fio_opts']['verify_pattern_interval'] = 512
+        elif csum == 'pattern_interval_nohdr':
+            test['fio_opts']['verify'] = "pattern"
+            test['fio_opts']['verify_pattern'] = '%o'
+            test['fio_opts']['verify_pattern_interval'] = 512
         else:
             test['fio_opts'].pop('verify_pattern', None)
+            test['fio_opts'].pop('verify_pattern_interval', None)
 
         if mbs == MANGLE_JOB_BS:
             test['fio_opts']['mangle_bs'] = test['fio_opts']['bs']
@@ -610,10 +636,20 @@ def verify_test(test_env, args, ddir, csum):
         test['fio_opts']['rw'] = ddir
         test['fio_opts']['verify'] = csum
 
-        if csum == 'pattern':
+        if csum in ('pattern', 'pattern_hdr'):
             test['fio_opts']['verify_pattern'] = '"abcd"-120xdeadface'
+            test['fio_opts'].pop('verify_pattern_interval', None)
+        elif csum == 'pattern_interval':
+            test['fio_opts']['verify'] = "pattern_hdr"
+            test['fio_opts']['verify_pattern'] = '%o'
+            test['fio_opts']['verify_pattern_interval'] = 512
+        elif csum == 'pattern_interval_nohdr':
+            test['fio_opts']['verify'] = "pattern"
+            test['fio_opts']['verify_pattern'] = '%o'
+            test['fio_opts']['verify_pattern_interval'] = 512
         else:
             test['fio_opts'].pop('verify_pattern', None)
+            test['fio_opts'].pop('verify_pattern_interval', None)
 
         # For 100% read data directions we need the write file that was written with
         # verify enabled. Use a previous test case for this by telling fio to
@@ -664,6 +700,9 @@ CSUM_LIST2 = [
         'sha3-384',
         'sha3-512',
         'pattern',
+        'pattern_hdr',
+        'pattern_interval',
+        'pattern_interval_nohdr',
         'null',
              ]
 
Signature · 1 line
2.47.2
author
#10 lore raw

PATCH 10/11 t/verify: Windows --output work-around

In reply to Vincent Fu

For a reason I do not understand Cygwin chokes when fio is given an option like the following:

--output==/home/vincent.fu/fio-vpi/verify-test-20250505-172034/pattern_%o_vpi_10_vi_1024/3001/verify3001.output

This is the resulting error:

pattern: %o, verify_pattern_interval: 129, verify_interval: 1024
Test 3000 FAILED: [Errno 2] No such file or directory: '/home/vincent.fu/fio-vpi/verify-test-20250505-172034/pattern_%o_vpi_129_vi_1024/3000/verify3000.output' 3000 Test 3001 FAILED: [Errno 2] No such file or directory: '/home/vincent.fu/fio-vpi/verify-test-20250505-172034/pattern_%o_vpi_129_vi_1024/3001/verify3001.output' 3001 0 test(s) passed, 2 failed, 0 skipped

It's not the length because other paths are longer. Even if I escape the % the error still occurs.

Work around this by simply using the filename instead of the entire path. The job runs with the test directory as the current working directory, so it's fine to just use the filename only.

---
 t/verify.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/verify.py +1 -1
index 8f0cb1ef..99ed61dc 100755
@@ -74,7 +74,7 @@ class VerifyTest(FioJobCmdTest):
             f"--ioengine={self.fio_opts['ioengine']}",
             f"--rw={self.fio_opts['rw']}",
             f"--verify={self.fio_opts['verify']}",
-            f"--output={self.filenames['output']}",
+            f"--output={os.path.basename(self.filenames['output'])}",
         ]
         for opt in VERIFY_OPT_LIST:
             if opt in self.fio_opts:
Signature · 1 line
2.47.2
author
#11 lore raw

PATCH 11/11 t/verify: add tests to exercise verify_pattern_interval

In reply to Vincent Fu

Add some more tests with oddball intervals and patterns to validate the verify_pattern_interval option.

---
 t/verify.py | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)
t/verify.py +76 -0
index 99ed61dc..58bf327d 100755
@@ -209,6 +209,41 @@ class VerifyCSUMTest(FioJobCmdTest):
             logging.debug("stderr: %s", contents)
 
 
+#
+# These tests exercise fio's verify_pattern_interval option.
+#
+TEST_LIST_VPI = [
+    {
+        # Basic test verify=pattern
+        "test_id": 3000,
+        "fio_opts": {
+            "ioengine": "psync",
+            "rw": "write",
+            "verify": "pattern",
+            "filesize": "1M",
+            "bs": 4096,
+            "output-format": "json",
+            },
+        "test_class": VerifyTest,
+        "success": SUCCESS_DEFAULT,
+    },
+    {
+        # Basic test verify=pattern_hdr
+        "test_id": 3001,
+        "fio_opts": {
+            "ioengine": "psync",
+            "rw": "write",
+            "verify": "pattern_hdr",
+            "filesize": "1M",
+            "bs": 4096,
+            "output-format": "json",
+            },
+        "test_class": VerifyTest,
+        "success": SUCCESS_DEFAULT,
+    },
+]
+
+
 #
 # These tests exercise fio's decisions about verifying the sequence number and
 # random seed in the verify header.
@@ -625,6 +660,25 @@ def verify_test_csum(test_env, args, mbs, csum):
     return run_fio_tests(TEST_LIST_CSUM, test_env, args)
 
 
+def verify_test_vpi(test_env, args, pattern, vpi, vi):
+    """
+    Adjust test arguments based on values of ddir and csum.  Then run
+    the tests.
+    """
+    for test in TEST_LIST_VPI:
+        test['force_skip'] = False
+
+        test['fio_opts']['verify_pattern'] = pattern
+        test['fio_opts']['verify_interval'] = vi
+        test['fio_opts']['verify_pattern_interval'] = vpi
+
+        for key in ['verify_interval', 'verify_pattern_interval']:
+            if not test['fio_opts'][key]:
+                test['fio_opts'].pop(key, None)
+
+    return run_fio_tests(TEST_LIST_VPI, test_env, args)
+
+
 def verify_test(test_env, args, ddir, csum):
     """
     Adjust test arguments based on values of ddir and csum.  Then run
@@ -769,6 +823,11 @@ def main():
             test['fio_opts']['ioengine'] = aio
         if 'sync' in test['fio_opts']['ioengine']:
             test['fio_opts']['ioengine'] = sync
+    for test in TEST_LIST_VPI:
+        if 'aio' in test['fio_opts']['ioengine']:
+            test['fio_opts']['ioengine'] = aio
+        if 'sync' in test['fio_opts']['ioengine']:
+            test['fio_opts']['ioengine'] = sync
 
     total = { 'passed':  0, 'failed': 0, 'skipped': 0 }
 
@@ -830,6 +889,23 @@ def main():
             total['failed'] += failed
             total['skipped'] += skipped
 
+        # The loop below is for verify_pattern_interval tests
+        pattern_list = ['%o', '"abcde"', '1%o',]
+        vpi_list = [10, 129, 512, 4089, None]
+        verify_interval_list = [512, 1024, 2222, 3791, None]
+        for pattern, vpi, vi in itertools.product(pattern_list, vpi_list, verify_interval_list):
+            print(f"\npattern: {pattern}, verify_pattern_interval: {vpi}, verify_interval: {vi}")
+
+            test_env['artifact_root'] = os.path.join(artifact_root,
+                f"pattern_{pattern}_vpi_{vpi}_vi_{vi}").replace('"', '').replace("%", 'pct')
+            os.mkdir(test_env['artifact_root'])
+
+            passed, failed, skipped = verify_test_vpi(test_env, args, pattern, vpi, vi)
+
+            total['passed'] += passed
+            total['failed'] += failed
+            total['skipped'] += skipped
+
     except KeyboardInterrupt:
         pass
 
Signature · 1 line
2.47.2
#13 lore raw
Quoted 4 lines · On 5/8/25 3:49 PM, [email protected] wrote:

The result of fio's continuous integration tests was: failure

For more details see https://github.com/fiotestbot/fio/actions/runs/14914258938

Hoisted by my own petard.

There was one test failure with t/jobs/t0010:

https://github.com/axboe/fio/blob/master/t/jobs/t0010-b7aae4ba.fio

This job is a simple io_submit_mode=offload test:

# Expected result: fio runs and completes the job
# Buggy result: fio segfaults
#
[test]
ioengine=null
size=10g
io_submit_mode=offload
iodepth=16

My changes do not touch this code. I looked at Actions runs in the main repository and found no similar failures in the 90 days of available logs. I did find two failures in Actions logs on my fork:

https://github.com/vincentkfu/fio/actions/runs/14414832872/job/40429681779

https://github.com/vincentkfu/fio/actions/runs/13680647374/job/38251879040

I re-ran the test suite on the failed platform for my patch series and it passed:

https://github.com/fiotestbot/fio/actions/runs/14914258938

So I am comfortable that my patches are not responsible for this failure.

Vincent

#14 lore raw
Quoted 29 lines · Fio Test Bot
Quoted 4 lines · On 5/8/25 3:49 PM, [email protected] wrote:

The result of fio's continuous integration tests was: failure

For more details see https://github.com/fiotestbot/fio/actions/ runs/14914258938

Hoisted by my own petard.

There was one test failure with t/jobs/t0010:

https://github.com/axboe/fio/blob/master/t/jobs/t0010-b7aae4ba.fio

This job is a simple io_submit_mode=offload test:

# Expected result: fio runs and completes the job
# Buggy result: fio segfaults
#
[test]
ioengine=null
size=10g
io_submit_mode=offload
iodepth=16

My changes do not touch this code. I looked at Actions runs in the main repository and found no similar failures in the 90 days of available logs. I did find two failures in Actions logs on my fork:

https://github.com/vincentkfu/fio/actions/runs/14414832872/job/40429681779

https://github.com/vincentkfu/fio/actions/runs/13680647374/job/38251879040

Quoted 8 lines

I re-ran the test suite on the failed platform for my patch series and it passed:

https://github.com/fiotestbot/fio/actions/runs/14914258938

So I am comfortable that my patches are not responsible for this failure.

Vincent

I have committed these patches.

Vincent