Add verify_fatal option
authorJens Axboe <jens.axboe@oracle.com>
Thu, 9 Aug 2007 08:20:54 +0000 (10:20 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 9 Aug 2007 08:20:54 +0000 (10:20 +0200)
Causes fio to exit after a single block verification failure, instead of
checking the remainder as well.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
HOWTO
fio.h
options.c
verify.c

diff --git a/HOWTO b/HOWTO
index cdfe80aa9fc4f1908ecf504a9ba5dae1b7a11071..ffd8d0a235a6a8b97df25fc4a91403757a026547 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -631,6 +631,11 @@ verify_pattern=int If set, fio will fill the io buffers with this
                width of the pattern, fio will fill 1/2/3/4 bytes of the
                buffer at the time. The verify_pattern cannot be larger than
                a 32-bit quantity.
                width of the pattern, fio will fill 1/2/3/4 bytes of the
                buffer at the time. The verify_pattern cannot be larger than
                a 32-bit quantity.
+
+verify_fatal=int       Normally fio will keep checking the entire contents
+               before quitting on a block verification failure. If this
+               option is set, fio will exit the job on the first observed
+               failure.
                
 stonewall      Wait for preceeding jobs in the job file to exit, before
                starting this one. Can be used to insert serialization
                
 stonewall      Wait for preceeding jobs in the job file to exit, before
                starting this one. Can be used to insert serialization
diff --git a/fio.h b/fio.h
index 0373d2af0fedef8fd9783e45720168d0644af518..6b111555d54363f28e1973b83c700d2b5297e35c 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -423,6 +423,7 @@ struct thread_options {
        unsigned int verify_offset;
        unsigned int verify_pattern;
        unsigned int verify_pattern_bytes;
        unsigned int verify_offset;
        unsigned int verify_pattern;
        unsigned int verify_pattern_bytes;
+       unsigned int verify_fatal;
        unsigned int use_thread;
        unsigned int unlink;
        unsigned int do_disk_util;
        unsigned int use_thread;
        unsigned int unlink;
        unsigned int do_disk_util;
index f5071ae55897774a3923c2ef6fbfe78e68ba5f96..62bbb43c893a08d21be4418a8f2c68932af35066 100644 (file)
--- a/options.c
+++ b/options.c
@@ -688,6 +688,14 @@ static struct fio_option options[] = {
                .help   = "Fill pattern for IO buffers",
                .parent = "verify",
        },
                .help   = "Fill pattern for IO buffers",
                .parent = "verify",
        },
+       {
+               .name   = "verify_fatal",
+               .type   = FIO_OPT_INT,
+               .off1   = td_var_offset(verify_fatal),
+               .def    = "0",
+               .help   = "Exit on a single verify failure, don't continue",
+               .parent = "verify",
+       },
        {
                .name   = "write_iolog",
                .type   = FIO_OPT_STR_STORE,
        {
                .name   = "write_iolog",
                .type   = FIO_OPT_STR_STORE,
index f5ed51a5354c35486c727ed18c7591886fef3bde..8427b6f9deb8fd4a6757b5e512b0e1197259a5a2 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -389,7 +389,12 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
        if (td->o.verify_interval)
                hdr_inc = td->o.verify_interval;
 
        if (td->o.verify_interval)
                hdr_inc = td->o.verify_interval;
 
+       ret = 0;
        for (p = io_u->buf; p < io_u->buf + io_u->buflen; p += hdr_inc, hdr_num++) {
        for (p = io_u->buf; p < io_u->buf + io_u->buflen; p += hdr_inc, hdr_num++) {
+               if (ret && td->o.verify_fatal) {
+                       td->terminate = 1;
+                       break;
+               }
                hdr_size = __hdr_size(td->o.verify);
                if (td->o.verify_offset)
                        memswp(p, p + td->o.verify_offset, hdr_size);
                hdr_size = __hdr_size(td->o.verify);
                if (td->o.verify_offset)
                        memswp(p, p + td->o.verify_offset, hdr_size);
@@ -444,7 +449,7 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
                }
        }
 
                }
        }
 
-       return 0;
+       return ret;
 }
 
 static void fill_meta(struct verify_header *hdr, struct thread_data *td,
 }
 
 static void fill_meta(struct verify_header *hdr, struct thread_data *td,