From f00b210f73a8562c2cc64d73aee04875d25162b0 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 30 Nov 2012 09:39:02 +0100 Subject: [PATCH] verify: treat as failure if given verify type is different from media When fio verifies right now, it'll look at the on media stored type and verify that type. This means that if verify=foo set and we find older blocks that are written with verify=bar, we will verify those against bar. Change this so that if a specific verify type is given, that type is ALWAYS used for verification. If none is given but asked to verify, we retain the old behaviour of just verifying based on the type given in the on-media block. Signed-off-by: Jens Axboe --- verify.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/verify.c b/verify.c index f246dc8f..c0485d55 100644 --- a/verify.c +++ b/verify.c @@ -690,6 +690,7 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u) .hdr_num = hdr_num, .td = td, }; + unsigned int verify_type; if (ret && td->o.verify_fatal) break; @@ -708,7 +709,12 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u) return EILSEQ; } - switch (hdr->verify_type) { + if (td->o.verify != VERIFY_NONE) + verify_type = td->o.verify; + else + verify_type = hdr->verify_type; + + switch (verify_type) { case VERIFY_MD5: ret = verify_io_u_md5(hdr, &vc); break; @@ -747,6 +753,10 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u) log_err("Bad verify type %u\n", hdr->verify_type); ret = EINVAL; } + + if (ret && verify_type != hdr->verify_type) + log_err("fio: verify type mismatch (%u media, %u given)\n", + hdr->verify_type, verify_type); } done: -- 2.25.1