From a12a3b4d8903b9941705067442c2c530a94635f3 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 9 Aug 2007 10:20:54 +0200 Subject: [PATCH] Add verify_fatal option Causes fio to exit after a single block verification failure, instead of checking the remainder as well. Signed-off-by: Jens Axboe --- HOWTO | 5 +++++ fio.h | 1 + options.c | 8 ++++++++ verify.c | 7 ++++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/HOWTO b/HOWTO index cdfe80aa..ffd8d0a2 100644 --- 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. + +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 diff --git a/fio.h b/fio.h index 0373d2af..6b111555 100644 --- 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_fatal; unsigned int use_thread; unsigned int unlink; unsigned int do_disk_util; diff --git a/options.c b/options.c index f5071ae5..62bbb43c 100644 --- a/options.c +++ b/options.c @@ -688,6 +688,14 @@ static struct fio_option options[] = { .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, diff --git a/verify.c b/verify.c index f5ed51a5..8427b6f9 100644 --- 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; + ret = 0; 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); @@ -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, -- 2.25.1