verify: add requested block information to failure trace
authorFeng, Changyu <Changyu.Feng@emc.com>
Tue, 6 Nov 2018 06:57:27 +0000 (01:57 -0500)
committerJens Axboe <axboe@kernel.dk>
Wed, 7 Nov 2018 04:30:32 +0000 (21:30 -0700)
If verify_interval is not equal to the block size, FIO would verify the
data one segment by one segment according to the verify_interval. The
offset and length in the verify failure trace are the offset and length
of the corrupted segment, not the offset and block size of the IO.

On block storage system, we need the offset and length of the IO to
investigate data corruption issue. For me, I usually search the offset
of the IO in the storage system trace to figure out what happened in the
system.

Fixes: https://github.com/axboe/fio/issues/709
Signed-off-by: Jens Axboe <axboe@kernel.dk>
verify.c

index 01492f24f9a0336c3b09ebb295aa0afe6963c4bd..da429e793a86e8f0198a8cffaa5bf8a964898fcc 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -345,8 +345,10 @@ static void log_verify_failure(struct verify_header *hdr, struct vcont *vc)
 
        offset = vc->io_u->offset;
        offset += vc->hdr_num * hdr->len;
-       log_err("%.8s: verify failed at file %s offset %llu, length %u\n",
-                       vc->name, vc->io_u->file->file_name, offset, hdr->len);
+       log_err("%.8s: verify failed at file %s offset %llu, length %u"
+                       " (requested block: offset=%llu, length=%llu)\n",
+                       vc->name, vc->io_u->file->file_name, offset, hdr->len,
+                       vc->io_u->offset, vc->io_u->buflen);
 
        if (vc->good_crc && vc->bad_crc) {
                log_err("       Expected CRC: ");
@@ -865,9 +867,11 @@ static int verify_header(struct io_u *io_u, struct thread_data *td,
        return 0;
 
 err:
-       log_err(" at file %s offset %llu, length %u\n",
+       log_err(" at file %s offset %llu, length %u"
+               " (requested block: offset=%llu, length=%llu)\n",
                io_u->file->file_name,
-               io_u->offset + hdr_num * hdr_len, hdr_len);
+               io_u->offset + hdr_num * hdr_len, hdr_len,
+               io_u->offset, io_u->buflen);
 
        if (td->o.verify_dump)
                dump_buf(p, hdr_len, io_u->offset + hdr_num * hdr_len,