int FileJournal::dump(ostream& out)
+{
+ return _dump(out, false);
+}
+
+int FileJournal::simple_dump(ostream& out)
+{
+ return _dump(out, true);
+}
+
+int FileJournal::_dump(ostream& out, bool simple)
{
dout(10) << "dump" << dendl;
f.open_object_section("entry");
f.dump_unsigned("offset", pos);
f.dump_unsigned("seq", seq);
- f.open_array_section("transactions");
- bufferlist::iterator p = bl.begin();
- int trans_num = 0;
- while (!p.end()) {
- ObjectStore::Transaction *t = new ObjectStore::Transaction(p);
- f.open_object_section("transaction");
- f.dump_unsigned("trans_num", trans_num);
- t->dump(&f);
+ if (simple) {
+ f.dump_unsigned("bl.length", bl.length());
+ } else {
+ f.open_array_section("transactions");
+ bufferlist::iterator p = bl.begin();
+ int trans_num = 0;
+ while (!p.end()) {
+ ObjectStore::Transaction *t = new ObjectStore::Transaction(p);
+ f.open_object_section("transaction");
+ f.dump_unsigned("trans_num", trans_num);
+ t->dump(&f);
+ f.close_section();
+ delete t;
+ trans_num++;
+ }
f.close_section();
- delete t;
- trans_num++;
}
f.close_section();
- f.close_section();
}
f.close_section();
void _close(int fd) const;
void _check_disk_write_cache() const;
int _open_file(int64_t oldsize, blksize_t blksize, bool create);
+ int _dump(ostream& out, bool simple);
void print_header(const header_t &hdr) const;
int read_header(header_t *hdr) const;
bufferptr prepare_header();
int peek_fsid(uuid_d& fsid);
int dump(ostream& out);
+ int simple_dump(ostream& out);
void flush();