[PATCH 12/21] init: fixup verify_offset option

Ankit Kumar <[email protected]>
Newsgroups org.kernel.vger.fio
Message-ID <[email protected]>
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 <[email protected]>
---
 HOWTO.rst |  3 ++-
 fio.1     |  3 ++-
 init.c    | 11 +++++++++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/HOWTO.rst b/HOWTO.rst
index ca0044ce..4293c03c 100644
--- a/HOWTO.rst
+++ b/HOWTO.rst
@@ -3929,7 +3929,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 fd580258..a0f204c0 100644
--- a/fio.1
+++ b/fio.1
@@ -3654,7 +3654,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 00a3a8c7..bf257ea1 100644
--- 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.
-- 
2.25.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.