The following changes since commit 0dd2d11ea010566fd2bc2661af58a0eefe49f750: Fio 1.41.6 (2010-07-09 13:48:14 +0200) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (3): Turn io_u filled variable into a flag Really fix broken option length check Fio 1.42 Radha Ramachandran (2): Reuse filled pattern No need to use specific flag for io_u fill length fio.c | 7 +++++++ init.c | 2 +- io_u.c | 7 +++++++ ioengine.h | 6 ++++++ parse.c | 13 ++++++++++++- verify.c | 15 +++++++++++++-- verify.h | 1 + 7 files changed, 47 insertions(+), 4 deletions(-) --- Diff of recent changes: diff --git a/fio.c b/fio.c index 2dab64e..896f797 100644 --- a/fio.c +++ b/fio.c @@ -831,6 +831,13 @@ static int init_io_u(struct thread_data *td) if (td_write(td) && !td->o.refill_buffers) io_u_fill_buffer(td, io_u, max_bs); + else if (td_write(td) && td->o.verify_pattern_bytes) { + /* + * Fill the buffer with the pattern if we are + * going to be doing writes. + */ + fill_pattern(td, io_u->buf, max_bs, io_u); + } } io_u->index = i; diff --git a/init.c b/init.c index 37c414e..bb645b0 100644 --- a/init.c +++ b/init.c @@ -21,7 +21,7 @@ #include "verify.h" #include "profile.h" -static char fio_version_string[] = "fio 1.41.6"; +static char fio_version_string[] = "fio 1.42"; #define FIO_RANDSEED (0xb1899bedUL) diff --git a/io_u.c b/io_u.c index b2b7230..f27cdda 100644 --- a/io_u.c +++ b/io_u.c @@ -983,6 +983,13 @@ struct io_u *get_io_u(struct thread_data *td) populate_verify_io_u(td, io_u); else if (td->o.refill_buffers && io_u->ddir == DDIR_WRITE) io_u_fill_buffer(td, io_u, io_u->xfer_buflen); + else if (io_u->ddir == DDIR_READ) { + /* + * Reset the buf_filled parameters so next time if the + * buffer is used for writes it is refilled. + */ + io_u->buf_filled_len = 0; + } } /* diff --git a/ioengine.h b/ioengine.h index 91dd429..e9f5d92 100644 --- a/ioengine.h +++ b/ioengine.h @@ -49,6 +49,12 @@ struct io_u { void *xfer_buf; unsigned long xfer_buflen; + /* + * Parameter related to pre-filled buffers and + * their size to handle variable block sizes. + */ + unsigned long buf_filled_len; + unsigned int resid; unsigned int error; diff --git a/parse.c b/parse.c index e03592d..d806161 100644 --- a/parse.c +++ b/parse.c @@ -278,6 +278,17 @@ static int check_int(const char *p, int *val) return 1; } +static int opt_len(const char *str) +{ + char *postfix; + + postfix = strchr(str, ':'); + if (!postfix) + return strlen(str); + + return (int)(postfix - str); +} + #define val_store(ptr, val, off, or, data) \ do { \ ptr = td_var((data), (off)); \ @@ -320,7 +331,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, if (!vp->ival || vp->ival[0] == '\0') continue; all_skipped = 0; - if (!strncmp(vp->ival, ptr, strlen(ptr))) { + if (!strncmp(vp->ival, ptr, opt_len(ptr))) { ret = 0; if (o->roff1) { if (vp->or) diff --git a/verify.c b/verify.c index 265bd55..42ea462 100644 --- a/verify.c +++ b/verify.c @@ -22,7 +22,7 @@ #include "crc/sha512.h" #include "crc/sha1.h" -static void fill_pattern(struct thread_data *td, void *p, unsigned int len) +void fill_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u *io_u) { switch (td->o.verify_pattern_bytes) { case 0: @@ -30,13 +30,23 @@ static void fill_pattern(struct thread_data *td, void *p, unsigned int len) fill_random_buf(p, len); break; case 1: + if (io_u->buf_filled_len >= len) { + dprint(FD_VERIFY, "using already filled verify pattern b=0 len=%u\n", len); + return; + } dprint(FD_VERIFY, "fill verify pattern b=0 len=%u\n", len); memset(p, td->o.verify_pattern[0], len); + io_u->buf_filled_len = len; break; default: { unsigned int i = 0, size = 0; unsigned char *b = p; + if (io_u->buf_filled_len >= len) { + dprint(FD_VERIFY, "using already filled verify pattern b=%d len=%u\n", + td->o.verify_pattern_bytes, len); + return; + } dprint(FD_VERIFY, "fill verify pattern b=%d len=%u\n", td->o.verify_pattern_bytes, len); @@ -47,6 +57,7 @@ static void fill_pattern(struct thread_data *td, void *p, unsigned int len) memcpy(b+i, td->o.verify_pattern, size); i += size; } + io_u->buf_filled_len = len; break; } } @@ -675,7 +686,7 @@ void populate_verify_io_u(struct thread_data *td, struct io_u *io_u) if (td->o.verify == VERIFY_NULL) return; - fill_pattern(td, p, io_u->buflen); + fill_pattern(td, p, io_u->buflen, io_u); hdr_inc = io_u->buflen; if (td->o.verify_interval) diff --git a/verify.h b/verify.h index a4a8cfe..29c4b46 100644 --- a/verify.h +++ b/verify.h @@ -69,6 +69,7 @@ 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 thread_data *, struct io_u *); extern int verify_io_u_async(struct thread_data *, struct io_u *); +extern void fill_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u *io_u); /* * Async verify offload -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html