Remove holes in verify_header structure
authorJens Axboe <axboe@kernel.dk>
Thu, 23 Feb 2012 07:23:18 +0000 (08:23 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 23 Feb 2012 07:23:18 +0000 (08:23 +0100)
Shrink the magic and verify_type members, and reorder so that
it packs nicely. Incompatible change, write workloads must be
re-run.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
verify.c
verify.h

index f40d7e1154cfa137d012d737319a28f9f520193f..696aff762abce69849e254cce47b6accd4fa9dd7 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -692,18 +692,9 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
                        memswp(p, p + td->o.verify_offset, header_size);
                hdr = p;
 
                        memswp(p, p + td->o.verify_offset, header_size);
                hdr = p;
 
-               if (hdr->fio_magic == FIO_HDR_MAGIC2) {
-                       if (!verify_hdr_crc(hdr)) {
-                               log_err("fio: bad crc on verify header.\n");
-                               return EILSEQ;
-                       }
-               } else if (hdr->fio_magic == FIO_HDR_MAGIC) {
-                       log_err("fio: v1 headers no longer supported.\n");
-                       log_err("fio: re-run the write workload.\n");
-                       return EILSEQ;
-               } else {
+               if (hdr->magic != FIO_HDR_MAGIC || !verify_hdr_crc(hdr)) {
                        log_err("verify: bad magic header %x, wanted %x at file %s offset %llu, length %u\n",
                        log_err("verify: bad magic header %x, wanted %x at file %s offset %llu, length %u\n",
-                               hdr->fio_magic, FIO_HDR_MAGIC2,
+                               hdr->magic, FIO_HDR_MAGIC,
                                io_u->file->file_name,
                                io_u->offset + hdr_num * hdr->len, hdr->len);
                        return EILSEQ;
                                io_u->file->file_name,
                                io_u->offset + hdr_num * hdr->len, hdr->len);
                        return EILSEQ;
@@ -860,12 +851,10 @@ static void populate_hdr(struct thread_data *td, struct io_u *io_u,
 
        p = (void *) hdr;
 
 
        p = (void *) hdr;
 
-       hdr->fio_magic = FIO_HDR_MAGIC2;
-       hdr->len = header_len;
+       hdr->magic = FIO_HDR_MAGIC;
        hdr->verify_type = td->o.verify;
        hdr->verify_type = td->o.verify;
-       hdr->pad1 = 0;
+       hdr->len = header_len;
        hdr->rand_seed = io_u->rand_seed;
        hdr->rand_seed = io_u->rand_seed;
-       hdr->pad2 = 0;
        hdr->crc32 = crc32c(p, sizeof(*hdr) - sizeof(hdr->crc32));
 
        data_len = header_len - hdr_size(hdr);
        hdr->crc32 = crc32c(p, sizeof(*hdr) - sizeof(hdr->crc32));
 
        data_len = header_len - hdr_size(hdr);
index ec7365c63bed7e167a86f2ec2c5015107864489f..7c238c8d2de6c07f19497061e12a4c60ba6b06c3 100644 (file)
--- a/verify.h
+++ b/verify.h
@@ -3,8 +3,7 @@
 
 #include <stdint.h>
 
 
 #include <stdint.h>
 
-#define FIO_HDR_MAGIC  0xf00baaef
-#define FIO_HDR_MAGIC2 0xf00dbeef
+#define FIO_HDR_MAGIC  0xacca
 
 enum {
        VERIFY_NONE = 0,                /* no verification */
 
 enum {
        VERIFY_NONE = 0,                /* no verification */
@@ -29,12 +28,10 @@ enum {
  * data.
  */
 struct verify_header {
  * data.
  */
 struct verify_header {
-       uint32_t fio_magic;
+       uint16_t magic;
+       uint16_t verify_type;
        uint32_t len;
        uint32_t len;
-       uint32_t verify_type;
-       uint32_t pad1;
        uint64_t rand_seed;
        uint64_t rand_seed;
-       uint32_t pad2;
        uint32_t crc32;
 };
 
        uint32_t crc32;
 };