Allow upper-case 'X' for hexidecimal in parser
[fio.git] / verify.c
index f5ed51a5354c35486c727ed18c7591886fef3bde..2acd216dec10a91f12b15f78d5f8257a90098194 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -112,6 +112,7 @@ static inline unsigned int __hdr_size(int verify_type)
        switch (verify_type) {
        case VERIFY_NONE:
        case VERIFY_NULL:
+       case VERIFY_PATTERN:
                len = 0;
                break;
        case VERIFY_MD5:
@@ -389,7 +390,12 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
        if (td->o.verify_interval)
                hdr_inc = td->o.verify_interval;
 
+       ret = 0;
        for (p = io_u->buf; p < io_u->buf + io_u->buflen; p += hdr_inc, hdr_num++) {
+               if (ret && td->o.verify_fatal) {
+                       td->terminate = 1;
+                       break;
+               }
                hdr_size = __hdr_size(td->o.verify);
                if (td->o.verify_offset)
                        memswp(p, p + td->o.verify_offset, hdr_size);
@@ -400,19 +406,6 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
                        return EIO;
                }
 
-               if (td->o.verify_pattern_bytes) {
-                       ret = verify_io_u_pattern(td->o.verify_pattern,
-                                                 td->o.verify_pattern_bytes,
-                                                 p + hdr_size,
-                                                 hdr_inc - hdr_size,
-                                                 hdr_size % 4);
-                       if (ret)
-                               log_err("fio: verify failed at %llu/%u\n",
-                                       io_u->offset + hdr_num * hdr->len,
-                                       hdr->len);
-                       continue;
-               }
-
                switch (hdr->verify_type) {
                case VERIFY_MD5:
                        ret = verify_io_u_md5(hdr, io_u, hdr_num);
@@ -438,13 +431,24 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
                case VERIFY_META:
                        ret = verify_io_u_meta(hdr, td, io_u, hdr_num);
                        break;
+               case VERIFY_PATTERN:
+                       ret = verify_io_u_pattern(td->o.verify_pattern,
+                                                 td->o.verify_pattern_bytes,
+                                                 p + hdr_size,
+                                                 hdr_inc - hdr_size,
+                                                 hdr_size % 4);
+                       if (ret)
+                               log_err("fio: verify failed at %llu/%u\n",
+                                       io_u->offset + hdr_num * hdr->len,
+                                       hdr->len);
+                       break;
                default:
                        log_err("Bad verify type %u\n", hdr->verify_type);
                        ret = 1;
                }
        }
 
-       return 0;
+       return ret;
 }
 
 static void fill_meta(struct verify_header *hdr, struct thread_data *td,
@@ -576,6 +580,8 @@ void populate_verify_io_u(struct thread_data *td, struct io_u *io_u)
                case VERIFY_META:
                        fill_meta(hdr, td, io_u, header_num);
                        break;
+               case VERIFY_PATTERN:
+                       break;
                default:
                        log_err("fio: bad verify type: %d\n", td->o.verify);
                        assert(0);