fio: Support verify_write_sequence
authorJohn Garry <john.g.garry@oracle.com>
Mon, 16 Sep 2024 16:53:46 +0000 (16:53 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 16 Sep 2024 18:15:15 +0000 (12:15 -0600)
Add an option to disable verifying the write sequence number. By default,
it is enabled. However disable for verify_only mode.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-9-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
HOWTO.rst
fio.1
init.c
options.c
thread_options.h
verify.c

index c6c9b3060043f2bb8ac4983d77d3e44c32d6e92b..4f071484bdc3fa7b02cc4dd51f87ec3ef97a601d 100644 (file)
--- a/HOWTO.rst
+++ b/HOWTO.rst
@@ -4002,6 +4002,17 @@ Verification
         instead resets the file after the write phase and then replays I/Os for
         the verification phase.
 
+.. option:: verify_write_sequence=bool
+
+        Verify the header write sequence number. In a scenario with multiple jobs,
+        verification of the write sequence number may fail. Disabling this option
+        will mean that write sequence number checking is skipped. Doing that can be
+        useful for testing atomic writes, as it means that checksum verification can
+        still be attempted. For when :option:`atomic` is enabled, checksum
+        verification is expected to succeed (while write sequence checking can still
+        fail).
+        Defaults to true.
+
 .. option:: trim_percentage=int
 
        Number of verify blocks to discard/trim.
diff --git a/fio.1 b/fio.1
index 6e5bed9d0610580bcb99fc2381f6e5a19598ee58..0fd0fb25f288e6a027c6611e2c49c425577750f7 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -3726,6 +3726,14 @@ Enable experimental verification. Standard verify records I/O metadata for
 later use during the verification phase. Experimental verify instead resets the
 file after the write phase and then replays I/Os for the verification phase.
 .TP
+.BI verify_write_sequence \fR=\fPbool
+Verify the header write sequence number. In a scenario with multiple jobs,
+verification of the write sequence number may fail. Disabling this option
+will mean that write sequence number checking is skipped. Doing that can be
+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 trim_percentage \fR=\fPint
 Number of verify blocks to discard/trim.
 .TP
diff --git a/init.c b/init.c
index bad8b75b4e25aa849a2bcca16f7453d28d27f59d..96a03d984b08b602ec42e1ac987d90bde322b221 100644 (file)
--- a/init.c
+++ b/init.c
@@ -853,6 +853,9 @@ static int fixup_options(struct thread_data *td)
                    (o->max_bs[DDIR_WRITE] % o->verify_interval))
                        o->verify_interval = gcd(o->min_bs[DDIR_WRITE],
                                                        o->max_bs[DDIR_WRITE]);
+
+               if (td->o.verify_only)
+                       o->verify_write_sequence = 0;
        }
 
        if (td->o.oatomic) {
index 95567de60b113667012971561b468881d6168f95..c35878f7bf6d9c9f3287e7d13e6e447ed7b89f68 100644 (file)
--- a/options.c
+++ b/options.c
@@ -3397,6 +3397,17 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_IO,
                .group  = FIO_OPT_G_VERIFY,
        },
+       {
+               .name   = "verify_write_sequence",
+               .lname  = "Verify write sequence number",
+               .off1   = offsetof(struct thread_options, verify_write_sequence),
+               .type   = FIO_OPT_BOOL,
+               .def    = "1",
+               .help   = "Verify header write sequence number",
+               .parent = "verify",
+               .category = FIO_OPT_C_IO,
+               .group  = FIO_OPT_G_VERIFY,
+       },
 #ifdef FIO_HAVE_TRIM
        {
                .name   = "trim_percentage",
index ee1e5b31bf27cf1f3042b20e95e8724b768bfcd8..d0e0a4aea2d3222f5eac37c96006e1ab04f5eed4 100644 (file)
@@ -156,6 +156,7 @@ struct thread_options {
        unsigned int experimental_verify;
        unsigned int verify_state;
        unsigned int verify_state_save;
+       unsigned int verify_write_sequence;
        unsigned int use_thread;
        unsigned int unlink;
        unsigned int unlink_each_loop;
index b2fede24710fd3fcedfbcda890b3b9def9a957be..f3d228ba7df8472c9fcbde72c776ff618b2a9486 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -848,12 +848,13 @@ static int verify_header(struct io_u *io_u, struct thread_data *td,
        /*
         * For read-only workloads, the program cannot be certain of the
         * last numberio written to a block. Checking of numberio will be
-        * done only for workloads that write data.  For verify_only,
-        * numberio check is skipped.
+        * done only for workloads that write data.  For verify_only or
+        * any mode de-selecting verify_write_sequence, numberio check is
+        * skipped.
         */
        if (td_write(td) && (td_min_bs(td) == td_max_bs(td)) &&
            !td->o.time_based)
-               if (!td->o.verify_only)
+               if (td->o.verify_write_sequence)
                        if (hdr->numberio != io_u->numberio) {
                                log_err("verify: bad header numberio %"PRIu16
                                        ", wanted %"PRIu16,