IO verification improvements
authorJens Axboe <jens.axboe@oracle.com>
Thu, 26 Jul 2007 10:22:30 +0000 (12:22 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 26 Jul 2007 10:22:30 +0000 (12:22 +0200)
- Add a FIO_UNIDIR io ops flag. This like networked IO can't be read/write,
  so verify only makes sense for data summed by another writer.
- Allow a read workload to verify previously written data.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
engines/net.c
fio.c
fio.h
init.c

index 52e3b049690dac057147122de59358de81b0fb0b..0cda953c852a11dba34602b21098c77b222863ec 100644 (file)
@@ -474,7 +474,7 @@ static struct ioengine_ops ioengine_splice = {
        .cleanup        = fio_netio_cleanup,
        .open_file      = fio_netio_open_file,
        .close_file     = generic_close_file,
        .cleanup        = fio_netio_cleanup,
        .open_file      = fio_netio_open_file,
        .close_file     = generic_close_file,
-       .flags          = FIO_SYNCIO | FIO_DISKLESSIO,
+       .flags          = FIO_SYNCIO | FIO_DISKLESSIO | FIO_UNIDIR,
 };
 
 static void fio_init fio_netio_register(void)
 };
 
 static void fio_init fio_netio_register(void)
diff --git a/fio.c b/fio.c
index 792d44228c694fb95e49f347a8ecb1605cd10e97..b8cba547ac931fcdf7ac0b3af79b7b19a7b8af75 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -446,6 +446,13 @@ static void do_io(struct thread_data *td)
                        break;
                }
 
                        break;
                }
 
+               /*
+                * Add verification end_io handler, if asked to verify
+                * a previously written file.
+                */
+               if (td->o.verify != VERIFY_NONE)
+                       io_u->end_io = verify_io_u;
+
                ret = td_io_queue(td, io_u);
                switch (ret) {
                case FIO_Q_COMPLETED:
                ret = td_io_queue(td, io_u);
                switch (ret) {
                case FIO_Q_COMPLETED:
@@ -894,7 +901,8 @@ static void *thread_main(void *data)
                if (td->error || td->terminate)
                        break;
 
                if (td->error || td->terminate)
                        break;
 
-               if (td->o.verify == VERIFY_NONE)
+               if (td->o.verify == VERIFY_NONE ||
+                   (td->io_ops->flags & FIO_UNIDIR))
                        continue;
 
                if (clear_io_state(td))
                        continue;
 
                if (clear_io_state(td))
diff --git a/fio.h b/fio.h
index ace4b1646342bc4f30d4fba539763000eb6b5745..8319a7a1323fcb3eb8225b4bd9178011e81568d3 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -243,6 +243,7 @@ enum fio_ioengine_flags {
        FIO_DISKLESSIO  = 1 << 2,       /* no disk involved */
        FIO_NOEXTEND    = 1 << 3,       /* engine can't extend file */
        FIO_NODISKUTIL  = 1 << 4,       /* diskutil can't handle filename */
        FIO_DISKLESSIO  = 1 << 2,       /* no disk involved */
        FIO_NOEXTEND    = 1 << 3,       /* engine can't extend file */
        FIO_NODISKUTIL  = 1 << 4,       /* diskutil can't handle filename */
+       FIO_UNIDIR      = 1 << 5,       /* engine is uni-directional */
 };
 
 enum fio_file_flags {
 };
 
 enum fio_file_flags {
diff --git a/init.c b/init.c
index 8be2a10a5a1cd779952bc655633b90698592c5cc..2514d90c53ce43d82d4029e804a9609a4e1eddf5 100644 (file)
--- a/init.c
+++ b/init.c
@@ -222,9 +222,6 @@ static int fixup_options(struct thread_data *td)
        if (!o->file_size_high)
                o->file_size_high = o->file_size_low;
 
        if (!o->file_size_high)
                o->file_size_high = o->file_size_low;
 
-       if (td_read(td) && !td_rw(td))
-               o->verify = 0;
-
        if (o->norandommap && o->verify != VERIFY_NONE) {
                log_err("fio: norandommap given, verify disabled\n");
                o->verify = VERIFY_NONE;
        if (o->norandommap && o->verify != VERIFY_NONE) {
                log_err("fio: norandommap given, verify disabled\n");
                o->verify = VERIFY_NONE;