summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Donnelly <pdonnell@redhat.com>2020-07-31 23:10:08 +0200
committerPatrick Donnelly <pdonnell@redhat.com>2020-07-31 23:10:08 +0200
commit293ec44e46c9c44ff0c8dfb33594e07088c2bdab (patch)
treef880e977e027a5ff187997865ed74ca3dbbebe81
parentMerge PR #32120 into master (diff)
parentcephfs-journal-tool: fix wrong read_offset when get missing objects (diff)
downloadceph-293ec44e46c9c44ff0c8dfb33594e07088c2bdab.tar.xz
ceph-293ec44e46c9c44ff0c8dfb33594e07088c2bdab.zip
Merge PR #35096 into master
* refs/pull/35096/head: cephfs-journal-tool: fix wrong read_offset when get missing objects Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> Reviewed-by: Zheng Yan <zyan@redhat.com>
-rw-r--r--src/tools/cephfs/JournalScanner.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/tools/cephfs/JournalScanner.cc b/src/tools/cephfs/JournalScanner.cc
index f88503e6164..e72542fd4a0 100644
--- a/src/tools/cephfs/JournalScanner.cc
+++ b/src/tools/cephfs/JournalScanner.cc
@@ -194,8 +194,15 @@ int JournalScanner::scan_events()
}
objects_missing.push_back(obj_offset);
- gap = true;
- gap_start = read_offset;
+ if (!gap) {
+ gap_start = read_offset;
+ gap = true;
+ }
+ if (read_buf.length() > 0) {
+ read_offset += read_buf.length();
+ read_buf.clear();
+ }
+ read_offset += object_size - offset_in_obj;
continue;
} else {
dout(4) << "Read 0x" << std::hex << this_object.length() << std::dec
@@ -229,7 +236,8 @@ int JournalScanner::scan_events()
}
} while (read_buf.length() >= sizeof(JournalStream::sentinel));
dout(4) << "read_buf size is " << read_buf.length() << dendl;
- } else {
+ }
+ {
dout(10) << "Parsing data, 0x" << std::hex << read_buf.length() << std::dec << " bytes available" << dendl;
while(true) {
// TODO: detect and handle legacy format journals: can do many things