Add 'null' verify option
authorJens Axboe <jens.axboe@oracle.com>
Mon, 26 Mar 2007 08:23:34 +0000 (10:23 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 26 Mar 2007 08:23:34 +0000 (10:23 +0200)
For testing purposes.

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

diff --git a/HOWTO b/HOWTO
index 8312d9315ae3a591b7a85cdd0822c86626ace840..a5be9dbd3e8d408bbe27491e4b15d76b30e5aa43 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -555,6 +555,10 @@ verify=str If writing to a file, fio can verify the file contents
                        crc32   Use a crc32 sum of the data area and store
                                it in the header of each block.
 
+                       null    Only pretend to verify. Useful for testing
+                               internals with ioengine=null, not for much
+                               else.
+
                This option can be used for repeated burn-in tests of a
                system to make sure that the written data is also
                correctly read back.
diff --git a/fio.h b/fio.h
index 4111bffbef7cfacb5ad8f1dfe27265bf898880ec..4d7e6ea7d8410132e787e577631c44a24b1b440d 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -102,6 +102,8 @@ enum {
        IO_U_F_FLIGHT   = 1 << 1,
 };
 
+struct thread_data;
+
 /*
  * The io unit
  */
@@ -162,7 +164,7 @@ struct io_u {
        /*
         * Callback for io completion
         */
-       int (*end_io)(struct io_u *);
+       int (*end_io)(struct thread_data *, struct io_u *);
 };
 
 /*
@@ -180,6 +182,7 @@ enum {
        VERIFY_NONE = 0,                /* no verification */
        VERIFY_MD5,                     /* md5 sum data blocks */
        VERIFY_CRC32,                   /* crc32 sum data blocks */
+       VERIFY_NULL,                    /* pretend to verify */
 };
 
 /*
@@ -744,7 +747,7 @@ enum {
  */
 extern void populate_verify_io_u(struct thread_data *, struct io_u *);
 extern int __must_check get_next_verify(struct thread_data *td, struct io_u *);
-extern int __must_check verify_io_u(struct io_u *);
+extern int __must_check verify_io_u(struct thread_data *, struct io_u *);
 
 /*
  * Memory helpers
diff --git a/io_u.c b/io_u.c
index 660db0701107264c0b491ff46eaaa39a6f9096ed..9c8ff2638df5ed3ea57bb943f04672a7b8f63077 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -666,7 +666,7 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
                icd->bytes_done[idx] += bytes;
 
                if (io_u->end_io) {
-                       ret = io_u->end_io(io_u);
+                       ret = io_u->end_io(td, io_u);
                        if (ret && !icd->error)
                                icd->error = ret;
                }
index bbb30990d28ba06955ea458a3b809f463a41e79c..5401f90339bf7da688b8e645656cec3a24ee7228 100644 (file)
--- a/options.c
+++ b/options.c
@@ -531,6 +531,11 @@ static struct fio_option options[] = {
                            .oval = VERIFY_MD5,
                            .help = "Use md5 checksums for verification",
                          },
+                         {
+                           .ival = "null",
+                           .oval = VERIFY_NULL,
+                           .help = "Pretend to verify",
+                         },
                },
        },
        {
index 7fbb2e6cd9ee9132e9eecb2eaddf27f71b163913..f1ac43bf1b9018e48664d16724ee906f5ca052ed 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -78,11 +78,14 @@ static int verify_io_u_md5(struct verify_header *hdr, struct io_u *io_u)
        return 0;
 }
 
-int verify_io_u(struct io_u *io_u)
+int verify_io_u(struct thread_data *td, struct io_u *io_u)
 {
        struct verify_header *hdr = (struct verify_header *) io_u->buf;
        int ret;
 
+       if (td->o.verify == VERIFY_NULL)
+               return 0;
+
        if (hdr->fio_magic != FIO_HDR_MAGIC) {
                log_err("Bad verify header %x\n", hdr->fio_magic);
                return EIO;
@@ -134,7 +137,7 @@ void populate_verify_io_u(struct thread_data *td, struct io_u *io_u)
        if (td->o.verify == VERIFY_MD5) {
                fill_md5(&hdr, p, io_u->buflen - sizeof(hdr));
                hdr.verify_type = VERIFY_MD5;
-       } else {
+       } else if (td->o.verify == VERIFY_CRC32) {
                fill_crc32(&hdr, p, io_u->buflen - sizeof(hdr));
                hdr.verify_type = VERIFY_CRC32;
        }