]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: skip up to expire_pos in journal-tool 2853/head
authorJohn Spray <john.spray@redhat.com>
Mon, 3 Nov 2014 19:19:45 +0000 (19:19 +0000)
committerJohn Spray <john.spray@redhat.com>
Mon, 3 Nov 2014 19:19:45 +0000 (19:19 +0000)
Previously worked for journals starting from an
object boundary (i.e. freshly created filesystems)

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

index 3b79a773f10ee3a711404b7d9f7f557d952832ca..f75edd9b29ff8b4ef8fb82b4834ef197fc08b235 100644 (file)
@@ -152,10 +152,17 @@ int JournalScanner::scan_events()
   bool gap = false;
   uint64_t gap_start = -1;
   for (uint64_t obj_offset = (read_offset / object_size); ; obj_offset++) {
+    uint64_t offset_in_obj = 0;
+    if (obj_offset * object_size < header->expire_pos) {
+      // Skip up to expire_pos from start of the object
+      // (happens for the first object we read)
+      offset_in_obj = header->expire_pos - obj_offset * object_size;
+    }
+
     // Read this journal segment
     bufferlist this_object;
     std::string const oid = obj_name(obj_offset);
-    int r = io.read(oid, this_object, INT_MAX, 0);
+    int r = io.read(oid, this_object, INT_MAX, offset_in_obj);
 
     // Handle absent journal segments
     if (r < 0) {