X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=verify.c;h=73c1262946f5c93a7deb5b28b898b2f4a6720c56;hp=265bd5563210bcb1db2cadd69c127e8f4c79869f;hb=cbe8d7561cf6d81d741d87eb7940db2a111d2144;hpb=0dd2d11ea010566fd2bc2661af58a0eefe49f750 diff --git a/verify.c b/verify.c index 265bd556..73c12629 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,24 @@ 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 && 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 = 1; + io_u->buf_filled_len = len; break; default: { unsigned int i = 0, size = 0; unsigned char *b = p; + if (io_u->buf_filled && 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 +58,8 @@ 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 = 1; + io_u->buf_filled_len = len; break; } } @@ -675,7 +688,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)