fio: add verify_header_seed option
authorAnkit Kumar <ankit.kumar@samsung.com>
Fri, 7 Feb 2025 17:44:15 +0000 (23:14 +0530)
committerVincent Fu <vincentfu@gmail.com>
Thu, 6 Mar 2025 18:58:43 +0000 (13:58 -0500)
Add a new option to disable the verify header seed check. The header
seed check is enabled by default.
There have been numerous issues observed with header seed mismatch. Hence
this allows end user to disable this check, and proceed with the checksum
verification. This is similar to option verify_write_sequence, which
allows the capability to disable write sequence number check.

Update the documentation accordingly.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
HOWTO.rst
cconv.c
fio.1
options.c
server.h
thread_options.h
verify.c

index d725960ee519e6e067da32a151710c2a352020c9..5ebaceb08685eee73c97af5735566090d56bf9d5 100644 (file)
--- a/HOWTO.rst
+++ b/HOWTO.rst
@@ -3832,8 +3832,9 @@ Verification
        of the job. Each verification method also implies verification of special
        header, which is written to the beginning of each block. This header also
        includes meta information, like offset of the block, block number, timestamp
-       when block was written, etc.  :option:`verify` can be combined with
-       :option:`verify_pattern` option.  The allowed values are:
+       when block was written, initial seed value used to generate the buffer
+       contents etc. :option:`verify` can be combined with :option:`verify_pattern`
+       option.  The allowed values are:
 
                **md5**
                        Use an md5 sum of the data area and store it in the header of
@@ -4031,6 +4032,15 @@ Verification
         fail).
         Defaults to true.
 
+.. option:: verify_header_seed=bool
+
+       Verify the header seed value which was used to generate the buffer contents.
+       In certain scenarios with read / verify only workloads, when
+       :option:`norandommap` is enabled, with offset modifiers
+       (refer :option:`readwrite` and :option:`rw_sequencer`) etc verification of
+       header seed may fail. Disabling this option will mean that header seed
+       checking is skipped. Defaults to true.
+
 .. option:: trim_percentage=int
 
        Number of verify blocks to discard/trim.
diff --git a/cconv.c b/cconv.c
index ef3fbaa86159e09db67beeed7d42d0af072d0824..df8417033dee9912d63d49a55f50259eab80a777 100644 (file)
--- a/cconv.c
+++ b/cconv.c
@@ -183,6 +183,7 @@ int convert_thread_options_to_cpu(struct thread_options *o,
        o->verify_interval = le32_to_cpu(top->verify_interval);
        o->verify_offset = le32_to_cpu(top->verify_offset);
        o->verify_write_sequence = le32_to_cpu(top->verify_write_sequence);
+       o->verify_header_seed = le32_to_cpu(top->verify_header_seed);
 
        o->verify_pattern_bytes = le32_to_cpu(top->verify_pattern_bytes);
        o->buffer_pattern_bytes = le32_to_cpu(top->buffer_pattern_bytes);
@@ -444,6 +445,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
        top->verify_interval = cpu_to_le32(o->verify_interval);
        top->verify_offset = cpu_to_le32(o->verify_offset);
        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_fatal = cpu_to_le32(o->verify_fatal);
        top->verify_dump = cpu_to_le32(o->verify_dump);
diff --git a/fio.1 b/fio.1
index d9412fd96ccd5889b9e4188a133b3d0a61595207..03078c3acf13e7cacef45ac048fe0a9f5d69ef11 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -3556,8 +3556,9 @@ If writing to a file, fio can verify the file contents after each iteration
 of the job. Each verification method also implies verification of special
 header, which is written to the beginning of each block. This header also
 includes meta information, like offset of the block, block number, timestamp
-when block was written, etc. \fBverify\fR can be combined with
-\fBverify_pattern\fR option. The allowed values are:
+when block was written, initial seed value used to generate the buffer
+contents, etc. \fBverify\fR can be combined with \fBverify_pattern\fR option.
+The allowed values are:
 .RS
 .RS
 .TP
@@ -3753,6 +3754,13 @@ useful for testing atomic writes, as it means that checksum verification can
 still be attempted. For when \fBatomic\fR is enabled, checksum verification
 is expected to succeed (while write sequence checking can still fail).
 .TP
+.BI verify_header_seed \fR=\fPbool
+Verify the header seed value which was used to generate the buffer contents.
+In certain scenarios with read / verify only workloads, when \fBnorandommap\fR
+is enabled, with offset modifiers (refer options \fBreadwrite\fR and
+\fBrw_sequencer\fR), etc verification of header seed may fail. Disabling this
+option will mean that header seed checking is skipped. Defaults to true.
+.TP
 .BI trim_percentage \fR=\fPint
 Number of verify blocks to discard/trim.
 .TP
index c35878f7bf6d9c9f3287e7d13e6e447ed7b89f68..416bc91c615880f6afc587cb944cdfa25727a44c 100644 (file)
--- a/options.c
+++ b/options.c
@@ -3408,6 +3408,17 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_IO,
                .group  = FIO_OPT_G_VERIFY,
        },
+       {
+               .name   = "verify_header_seed",
+               .lname  = "Verify header seed",
+               .off1   = offsetof(struct thread_options, verify_header_seed),
+               .type   = FIO_OPT_BOOL,
+               .def    = "1",
+               .help   = "Verify the header seed used to generate the buffer contents",
+               .parent = "verify",
+               .category = FIO_OPT_C_IO,
+               .group  = FIO_OPT_G_VERIFY,
+       },
 #ifdef FIO_HAVE_TRIM
        {
                .name   = "trim_percentage",
index d31cd68890cc636a7720ba99f92911e3134ca9a1..e596811248cf7af57f03b87ba6885c917b51575a 100644 (file)
--- a/server.h
+++ b/server.h
@@ -51,7 +51,7 @@ struct fio_net_cmd_reply {
 };
 
 enum {
-       FIO_SERVER_VER                  = 108,
+       FIO_SERVER_VER                  = 109,
 
        FIO_SERVER_MAX_FRAGMENT_PDU     = 1024,
        FIO_SERVER_MAX_CMD_MB           = 2048,
index 4d8addc454f4395adc4f4b3d0cb7eb961bb830d6..d25ba891e32cdec49467a979bd07a8bde1d1cfc2 100644 (file)
@@ -157,6 +157,7 @@ struct thread_options {
        unsigned int verify_state;
        unsigned int verify_state_save;
        unsigned int verify_write_sequence;
+       unsigned int verify_header_seed;
        unsigned int use_thread;
        unsigned int unlink;
        unsigned int unlink_each_loop;
@@ -485,7 +486,7 @@ struct thread_options_pack {
        uint32_t verify_state;
        uint32_t verify_state_save;
        uint32_t verify_write_sequence;
-       uint32_t pad2;
+       uint32_t verify_header_seed;
        uint32_t use_thread;
        uint32_t unlink;
        uint32_t unlink_each_loop;
index 570c888f01bb7e1d694f9c8640dc8e599b209184..49d4498224b9c1d10105bba0e15ea1b10cba608d 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -833,7 +833,7 @@ static int verify_header(struct io_u *io_u, struct thread_data *td,
                        hdr->len, hdr_len);
                goto err;
        }
-       if (hdr->rand_seed != io_u->rand_seed) {
+       if (td->o.verify_header_seed && (hdr->rand_seed != io_u->rand_seed)) {
                log_err("verify: bad header rand_seed %"PRIu64
                        ", wanted %"PRIu64,
                        hdr->rand_seed, io_u->rand_seed);