From: Juan Casse Date: Tue, 17 Sep 2013 21:06:12 +0000 (-0700) Subject: Adds check for numberio during verify phase. X-Git-Tag: fio-2.1.5~31 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=da0a7bd224bb9331f27bb4b20394dd5c8fa3acb0 Adds check for numberio during verify phase. 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 Reviewed-by: Grant Grundler Fixed typo. Signed-off-by: Jens Axboe --- diff --git a/ioengine.h b/ioengine.h index 6dd2aa40..949af915 100644 --- a/ioengine.h +++ b/ioengine.h @@ -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 65933672..ec29971f 100644 --- 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 6503acff..321576db 100644 --- 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; diff --git a/libfio.c b/libfio.c index 7eb4576f..222cd16d 100644 --- 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; diff --git a/verify.c b/verify.c index 721aeb46..f592c55c 100644 --- 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;