public inbox for fio@vger.kernel.org
 help / color / mirror / Atom feed
From: Vincent Fu <vincentfu@gmail.com>
To: fio@vger.kernel.org, axboe@kernel.dk
Cc: Vincent Fu <vincent.fu@samsung.com>
Subject: [PATCH 02/11] verify: fix verify_offset when used with pattern_hdr
Date: Thu,  8 May 2025 14:58:10 -0400	[thread overview]
Message-ID: <20250508185832.3702-3-vincent.fu@samsung.com> (raw)
In-Reply-To: <20250508185832.3702-1-vincent.fu@samsung.com>

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%

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
---
 verify.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/verify.c b/verify.c
index 928bdd54..e7e619d3 100644
--- a/verify.c
+++ b/verify.c
@@ -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;
-- 
2.47.2


  parent reply	other threads:[~2025-05-08 18:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 18:58 [PATCH 00/11] verify pattern interval Vincent Fu
2025-05-08 18:58 ` [PATCH 01/11] verify: add verify mode for a pattern with header Vincent Fu
2025-05-08 18:58 ` Vincent Fu [this message]
2025-05-08 18:58 ` [PATCH 03/11] verify: make verify_pattern=%o thread safe Vincent Fu
2025-05-08 18:58 ` [PATCH 04/11] verify: omit verify type mismatch error message for pattern verify Vincent Fu
2025-05-08 18:58 ` [PATCH 05/11] t/fiotestcommon: lengthen timeout for longer tests Vincent Fu
2025-05-08 18:58 ` [PATCH 06/11] ci: for nightly verify tests use all checksum methods Vincent Fu
2025-05-08 18:58 ` [PATCH 07/11] ci: don't skip verify tests when triggered manually Vincent Fu
2025-05-08 18:58 ` [PATCH 08/11] verify: add verify_pattern_interval option Vincent Fu
2025-05-08 18:58 ` [PATCH 09/11] t/verify: test cases for running pattern and pattern_hdr Vincent Fu
2025-05-08 18:58 ` [PATCH 10/11] t/verify: Windows --output work-around Vincent Fu
2025-05-08 18:58 ` [PATCH 11/11] t/verify: add tests to exercise verify_pattern_interval Vincent Fu
2025-05-08 19:49 ` [PATCH 00/11] verify pattern interval fiotestbot
2025-05-09  0:54   ` Fio Test Bot
2025-05-16 18:08     ` Fio Test Bot

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=20250508185832.3702-3-vincent.fu@samsung.com \
    --to=vincentfu@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=vincent.fu@samsung.com \
    /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