]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/cephfs: fuller header in dump/undump 2159/head
authorJohn Spray <jspray@redhat.com>
Mon, 28 Jul 2014 14:32:12 +0000 (15:32 +0100)
committerJohn Spray <john.spray@redhat.com>
Mon, 28 Jul 2014 14:50:49 +0000 (15:50 +0100)
There were two problems here:
 * write_pos was modified through an undump/dump cycle,
   because it was probed during recovery.
 * stream format was being forgotten.

Signed-off-by: John Spray <john.spray@redhat.com>
src/tools/cephfs/Dumper.cc

index 72d14e8add2e5e9825ec8e555859064f39dd7a04..665fa88a5050535dff76dd69dd17d5241a4b1a0c 100644 (file)
@@ -102,10 +102,12 @@ void Dumper::dump(const char *dump_file)
     // include an informative header
     char buf[200];
     memset(buf, 0, sizeof(buf));
-    sprintf(buf, "Ceph mds%d journal dump\n start offset %llu (0x%llx)\n       length %llu (0x%llx)\n%c",
+    sprintf(buf, "Ceph mds%d journal dump\n start offset %llu (0x%llx)\n       length %llu (0x%llx)\n    write_pos %llu (0x%llx)\n    format %llu\n%c",
            rank, 
            (unsigned long long)start, (unsigned long long)start,
            (unsigned long long)bl.length(), (unsigned long long)bl.length(),
+           (unsigned long long)journaler.last_committed.write_pos, (unsigned long long)journaler.last_committed.write_pos,
+           (unsigned long long)journaler.last_committed.stream_format,
            4);
     int r = safe_write(fd, buf, sizeof(buf));
     if (r)
@@ -148,16 +150,19 @@ void Dumper::undump(const char *dump_file)
     return;
   }
 
-  long long unsigned start, len;
+  long long unsigned start, len, write_pos, format;
   sscanf(strstr(buf, "start offset"), "start offset %llu", &start);
   sscanf(strstr(buf, "length"), "length %llu", &len);
+  sscanf(strstr(buf, "write_pos"), "write_pos %llu", &write_pos);
+  sscanf(strstr(buf, "format"), "format %llu", &format);
 
   cout << "start " << start << " len " << len << std::endl;
   
   Journaler::Header h;
   h.trimmed_pos = start;
   h.expire_pos = start;
-  h.write_pos = start+len;
+  h.write_pos = write_pos;
+  h.stream_format = format;
   h.magic = CEPH_FS_ONDISK_MAGIC;
 
   h.layout = g_default_file_layout;