Revert "Remove verify_pattern option, replace with verify=pattern:x"
authorShawn Lewis <shawnlewis@google.com>
Wed, 16 Jan 2008 10:01:33 +0000 (11:01 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 16 Jan 2008 10:01:33 +0000 (11:01 +0100)
This reverts commit bfb41d98f63cb9fb72cb7c82618be10bc6d52c33.

Reverting lets us have verify=meta and specify a verify_pattern at the same
time. Sample surfacescan conf file coming up.

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

diff --git a/HOWTO b/HOWTO
index 7b717f7739664f44393d67b7b6521e8ca0404eae..ca095a322895be3065081db5bd600fb12609f3e7 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -629,15 +629,6 @@ verify=str If writing to a file, fio can verify the file contents
                                (timestamp, block number etc.). The block
                                number is verified.
 
                                (timestamp, block number etc.). The block
                                number is verified.
 
-                       pattern Fill the IO buffers with a specific pattern,
-                               that we can use to verify. Depending on the
-                               width of the pattern, fio will fill 1/2/3/4
-                               bytes of the buffer at the time. The pattern
-                               cannot be larger than a 32-bit quantity. The
-                               given pattern is given as a postfix to this
-                               option, ala: verify=pattern:0x5a. It accepts
-                               both hex and dec values.
-
                        null    Only pretend to verify. Useful for testing
                                internals with ioengine=null, not for much
                                else.
                        null    Only pretend to verify. Useful for testing
                                internals with ioengine=null, not for much
                                else.
@@ -663,6 +654,14 @@ verify_interval=siint      Write the verification header at a finer granularity
                        size of header_interval. blocksize should divide this
                        evenly.
 
                        size of header_interval. blocksize should divide this
                        evenly.
 
+verify_pattern=int     If set, fio will fill the io buffers with this
+               pattern. Fio defaults to filling with totally random
+               bytes, but sometimes it's interesting to fill with a known
+               pattern for io verification purposes. Depending on the
+               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=bool      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
 verify_fatal=bool      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
diff --git a/fio.h b/fio.h
index 7c39be323f2a193c0b460213059f9545838047eb..09bf6a203c7c4b72450d60c27b34e93d174fbac6 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -184,7 +184,6 @@ enum {
        VERIFY_SHA256,                  /* sha256 sum data blocks */
        VERIFY_SHA512,                  /* sha512 sum data blocks */
        VERIFY_META,                    /* block_num, timestamp etc. */
        VERIFY_SHA256,                  /* sha256 sum data blocks */
        VERIFY_SHA512,                  /* sha512 sum data blocks */
        VERIFY_META,                    /* block_num, timestamp etc. */
-       VERIFY_PATTERN,                 /* verify a specific pattern */
        VERIFY_NULL,                    /* pretend to verify */
 };
 
        VERIFY_NULL,                    /* pretend to verify */
 };
 
index 36f80fce61a7f6fe24dda2c474580bc3b74bb4bf..d17dbb1cd6f45696866822a0b190fb77129331e6 100644 (file)
--- a/options.c
+++ b/options.c
@@ -333,27 +333,12 @@ static int str_verify_offset_cb(void *data, unsigned int *off)
        return 0;
 }
 
        return 0;
 }
 
-static int str_verify_cb(void *data, const char *mem)
+static int str_verify_pattern_cb(void *data, unsigned int *off)
 {
        struct thread_data *td = data;
 {
        struct thread_data *td = data;
-       unsigned int nr, msb;
-       char *pat;
+       unsigned int msb;
 
 
-       if (td->o.verify != VERIFY_PATTERN)
-               return 0;
-
-       pat = get_opt_postfix(mem);
-       if (!pat) {
-               log_err("fio: missing pattern\n");
-               return 1;
-       }
-
-       if (strstr(pat, "0x") || strstr(pat, "0X"))
-               nr = strtol(pat, NULL, 16);
-       else
-               nr = strtol(pat, NULL, 16);
-
-       msb = fls(nr);
+       msb = fls(*off);
        if (msb <= 8)
                td->o.verify_pattern_bytes = 1;
        else if (msb <= 16)
        if (msb <= 8)
                td->o.verify_pattern_bytes = 1;
        else if (msb <= 16)
@@ -363,7 +348,7 @@ static int str_verify_cb(void *data, const char *mem)
        else
                td->o.verify_pattern_bytes = 4;
 
        else
                td->o.verify_pattern_bytes = 4;
 
-       td->o.verify_pattern = nr;
+       td->o.verify_pattern = *off;
        return 0;
 }
 
        return 0;
 }
 
@@ -752,7 +737,6 @@ static struct fio_option options[] = {
                .name   = "verify",
                .type   = FIO_OPT_STR,
                .off1   = td_var_offset(verify),
                .name   = "verify",
                .type   = FIO_OPT_STR,
                .off1   = td_var_offset(verify),
-               .cb     = str_verify_cb,
                .help   = "Verify data written",
                .def    = "0",
                .posval = {
                .help   = "Verify data written",
                .def    = "0",
                .posval = {
@@ -792,10 +776,6 @@ static struct fio_option options[] = {
                            .oval = VERIFY_META,
                            .help = "Use io information",
                          },
                            .oval = VERIFY_META,
                            .help = "Use io information",
                          },
-                         { .ival = "pattern",
-                           .oval = VERIFY_PATTERN,
-                           .help = "Verify a specific buffer pattern",
-                         },
                          {
                            .ival = "null",
                            .oval = VERIFY_NULL,
                          {
                            .ival = "null",
                            .oval = VERIFY_NULL,
@@ -835,6 +815,13 @@ static struct fio_option options[] = {
                .cb     = str_verify_offset_cb, 
                .parent = "verify",
        },
                .cb     = str_verify_offset_cb, 
                .parent = "verify",
        },
+       {
+               .name   = "verify_pattern",
+               .type   = FIO_OPT_INT,
+               .cb     = str_verify_pattern_cb,
+               .help   = "Fill pattern for IO buffers",
+               .parent = "verify",
+       },
        {
                .name   = "verify_fatal",
                .type   = FIO_OPT_BOOL,
        {
                .name   = "verify_fatal",
                .type   = FIO_OPT_BOOL,
index 59a9ddedb6157c0e5a31171069fdb0bab6195bbf..3cda3267c9f7262f88aa59f71dfb33614d0fcdf6 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -112,7 +112,6 @@ static inline unsigned int __hdr_size(int verify_type)
        switch (verify_type) {
        case VERIFY_NONE:
        case VERIFY_NULL:
        switch (verify_type) {
        case VERIFY_NONE:
        case VERIFY_NULL:
-       case VERIFY_PATTERN:
                len = 0;
                break;
        case VERIFY_MD5:
                len = 0;
                break;
        case VERIFY_MD5:
@@ -406,6 +405,19 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
                        return EIO;
                }
 
                        return EIO;
                }
 
+               if (td->o.verify_pattern_bytes) {
+                       ret = verify_io_u_pattern(td->o.verify_pattern,
+                                                 td->o.verify_pattern_bytes,
+                                                 p + hdr_size,
+                                                 hdr_inc - hdr_size,
+                                                 hdr_size % 4);
+                       if (ret)
+                               log_err("fio: verify failed at %llu/%u\n",
+                                       io_u->offset + hdr_num * hdr->len,
+                                       hdr->len);
+                       continue;
+               }
+
                switch (hdr->verify_type) {
                case VERIFY_MD5:
                        ret = verify_io_u_md5(hdr, io_u, hdr_num);
                switch (hdr->verify_type) {
                case VERIFY_MD5:
                        ret = verify_io_u_md5(hdr, io_u, hdr_num);
@@ -431,17 +443,6 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
                case VERIFY_META:
                        ret = verify_io_u_meta(hdr, td, io_u, hdr_num);
                        break;
                case VERIFY_META:
                        ret = verify_io_u_meta(hdr, td, io_u, hdr_num);
                        break;
-               case VERIFY_PATTERN:
-                       ret = verify_io_u_pattern(td->o.verify_pattern,
-                                                 td->o.verify_pattern_bytes,
-                                                 p + hdr_size,
-                                                 hdr_inc - hdr_size,
-                                                 hdr_size % 4);
-                       if (ret)
-                               log_err("fio: verify failed at %llu/%u\n",
-                                       io_u->offset + hdr_num * hdr->len,
-                                       hdr->len);
-                       break;
                default:
                        log_err("Bad verify type %u\n", hdr->verify_type);
                        ret = EINVAL;
                default:
                        log_err("Bad verify type %u\n", hdr->verify_type);
                        ret = EINVAL;
@@ -580,8 +581,6 @@ void populate_verify_io_u(struct thread_data *td, struct io_u *io_u)
                case VERIFY_META:
                        fill_meta(hdr, td, io_u, header_num);
                        break;
                case VERIFY_META:
                        fill_meta(hdr, td, io_u, header_num);
                        break;
-               case VERIFY_PATTERN:
-                       break;
                default:
                        log_err("fio: bad verify type: %d\n", td->o.verify);
                        assert(0);
                default:
                        log_err("fio: bad verify type: %d\n", td->o.verify);
                        assert(0);