Adds check for numberio during verify phase.
authorJuan Casse <jcasse@chromium.org>
Tue, 17 Sep 2013 21:06:12 +0000 (14:06 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 24 Jan 2014 20:04:50 +0000 (12:04 -0800)
Currently, fio checks the block offset number in a block's header during
the verify phase.
We add a check for the io number (numberio) to detect stale blocks. This
check is performed only on workloads that write data, as those workloads
know what numberio was written to each block.
td->io_issues[ddir] = 0; was removed so that numberio does not get reset
at each iteration; we want numberio to keep incrementing to reflect
how many times the same data was written.

Signed-off-by: Juan Casse <jcasse@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
Fixed typo.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
ioengine.h
iolog.c
iolog.h
libfio.c
verify.c

index 6dd2aa40f478362e86459d563d673d425f2669b1..949af9150613c8b398f389fee71c0cfa65b692e7 100644 (file)
@@ -50,6 +50,7 @@ struct io_u {
         */
        unsigned long buflen;
        unsigned long long offset;
+       unsigned short numberio;
        void *buf;
 
        /*
diff --git a/iolog.c b/iolog.c
index 65933672fa3e3da4ef8a5b59b6f70636f076a955..ec29971f6a51dfd2d67dc3e00f0c90a76264c7fc 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -188,6 +188,7 @@ void log_io_piece(struct thread_data *td, struct io_u *io_u)
        ipo->file = io_u->file;
        ipo->offset = io_u->offset;
        ipo->len = io_u->buflen;
+       ipo->numberio = io_u->numberio;
 
        if (io_u_should_trim(td, io_u)) {
                flist_add_tail(&ipo->trim_list, &td->trim_list);
diff --git a/iolog.h b/iolog.h
index 6503acffd10659b2ff4e5d5f187b9d5c516de28b..321576dbe6117946e1458ee3233ed14f0d7612cf 100644 (file)
--- a/iolog.h
+++ b/iolog.h
@@ -83,6 +83,7 @@ struct io_piece {
                struct fio_file *file;
        };
        unsigned long long offset;
+       unsigned short numberio;
        unsigned long len;
        unsigned int flags;
        enum fio_ddir ddir;
index 7eb4576f7b1e35e2e1b0e3bf6baf0b6f7c3080ca..222cd16dec8fe3f039c55749af37656679977221 100644 (file)
--- a/libfio.c
+++ b/libfio.c
@@ -85,7 +85,6 @@ static void reset_io_counters(struct thread_data *td)
                td->this_io_blocks[ddir] = 0;
                td->rate_bytes[ddir] = 0;
                td->rate_blocks[ddir] = 0;
-               td->io_issues[ddir] = 0;
        }
        td->zone_bytes = 0;
 
index 721aeb46635701b3f0f1cca8fc2db18d8c2cc4eb..f592c55c509e6e811417bf73b654b9dfae8adce5 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -383,6 +383,15 @@ static int verify_io_u_meta(struct verify_header *hdr, struct vcont *vc)
        if (td->o.verify_pattern_bytes)
                ret |= verify_io_u_pattern(hdr, vc);
 
+       /*
+        * For read-only workloads, the program cannot be certain of the
+        * last numberio written to a block. Checking of numberio will be done
+        * only for workloads that write data.
+        */
+       if (td_write(td) || td_rw(td))
+               if (vh->numberio != io_u->numberio)
+                       ret = EILSEQ;
+
        if (!ret)
                return 0;
 
@@ -782,7 +791,7 @@ static void fill_meta(struct verify_header *hdr, struct thread_data *td,
        vh->time_sec = io_u->start_time.tv_sec;
        vh->time_usec = io_u->start_time.tv_usec;
 
-       vh->numberio = td->io_issues[DDIR_WRITE];
+       vh->numberio = io_u->numberio;
 
        vh->offset = io_u->offset + header_num * td->o.verify_interval;
 }
@@ -956,6 +965,8 @@ void populate_verify_io_u(struct thread_data *td, struct io_u *io_u)
        if (td->o.verify == VERIFY_NULL)
                return;
 
+       io_u->numberio = td->io_issues[io_u->ddir];
+
        fill_pattern_headers(td, io_u, 0, 0);
 }
 
@@ -988,6 +999,7 @@ int get_next_verify(struct thread_data *td, struct io_u *io_u)
 
                io_u->offset = ipo->offset;
                io_u->buflen = ipo->len;
+               io_u->numberio = ipo->numberio;
                io_u->file = ipo->file;
                io_u->flags |= IO_U_F_VER_LIST;