init: fixup verify_offset option
authorAnkit Kumar <ankit.kumar@samsung.com>
Tue, 28 Jan 2025 14:46:14 +0000 (20:16 +0530)
committerVincent Fu <vincentfu@gmail.com>
Thu, 6 Mar 2025 18:58:43 +0000 (13:58 -0500)
Verify offset should swap verification header within the verify interval.
If this is not the case return error. Update the doc. accordingly.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
HOWTO.rst
fio.1
init.c

index 41ebabee3c438ca40dbae2df4e8db31463ba66e1..fb6dddcfdd43592f40951afa2667c4175b64a977 100644 (file)
--- a/HOWTO.rst
+++ b/HOWTO.rst
@@ -3931,7 +3931,8 @@ Verification
 .. option:: verify_offset=int
 
        Swap the verification header with data somewhere else in the block before
-       writing. It is swapped back before verifying.
+       writing. It is swapped back before verifying. This should be within the
+       range of :option:`verify_interval`.
 
 .. option:: verify_interval=int
 
diff --git a/fio.1 b/fio.1
index d7485bb4930d4b921e4e7053eba4d1f83b36693c..83e77678072e20865d2b978c260a7fadf89d6cfd 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -3656,7 +3656,8 @@ same offset with multiple outstanding I/Os.
 .TP
 .BI verify_offset \fR=\fPint
 Swap the verification header with data somewhere else in the block before
-writing. It is swapped back before verifying.
+writing. It is swapped back before verifying. This should be within the range
+of \fBverify_interval\fR.
 .TP
 .BI verify_interval \fR=\fPint
 Write the verification header at a finer granularity than the
diff --git a/init.c b/init.c
index 00a3a8c7e46ff6566ea997f34d2188aded2c750e..bf257ea1687be43abfb37de1718c9082c197883d 100644 (file)
--- a/init.c
+++ b/init.c
@@ -873,6 +873,17 @@ static int fixup_options(struct thread_data *td)
                                o->verify_write_sequence = 0;
                }
 
+               /*
+                * Verify header should not be offset beyond the verify
+                * interval.
+                */
+               if (o->verify_offset + sizeof(struct verify_header) >
+                   o->verify_interval) {
+                       log_err("fio: cannot offset verify header beyond the "
+                               "verify interval.\n");
+                       ret |= 1;
+               }
+
                /*
                 * Disable rand_seed check when we have verify_backlog,
                 * zone reset frequency for zonemode=zbd, or norandommap.