|
22 | 22 | #include <string_view> |
23 | 23 | #include <vector> |
24 | 24 |
|
25 | | -#include "common/Formatter.h" |
26 | 25 | #include "include/compact_set.h" |
27 | 26 | #include "include/encoding.h" |
28 | 27 | #include "include/fs_types.h" |
|
36 | 35 | #define CEPH_FS_ONDISK_MAGIC "ceph fs volume v011" |
37 | 36 | #define MAX_MDS 0x100 |
38 | 37 |
|
| 38 | +namespace ceph { class Formatter; } |
39 | 39 | class JSONObj; |
40 | 40 |
|
41 | 41 | BOOST_STRONG_TYPEDEF(uint64_t, mds_gid_t) |
@@ -211,10 +211,7 @@ struct vinodeno_t { |
211 | 211 | decode(ino, p); |
212 | 212 | decode(snapid, p); |
213 | 213 | } |
214 | | - void dump(ceph::Formatter *f) const { |
215 | | - f->dump_unsigned("ino", ino); |
216 | | - f->dump_unsigned("snapid", snapid); |
217 | | - } |
| 214 | + void dump(ceph::Formatter *f) const; |
218 | 215 | static void generate_test_instances(std::list<vinodeno_t*>& ls) { |
219 | 216 | ls.push_back(new vinodeno_t); |
220 | 217 | ls.push_back(new vinodeno_t(1, 2)); |
@@ -298,11 +295,7 @@ class charmap_md_t { |
298 | 295 | return casesensitive; |
299 | 296 | } |
300 | 297 |
|
301 | | - void dump(ceph::Formatter* f) const { |
302 | | - f->dump_bool("casesensitive", casesensitive); |
303 | | - f->dump_string("normalization", normalization); |
304 | | - f->dump_string("encoding", encoding); |
305 | | - } |
| 298 | + void dump(ceph::Formatter* f) const; |
306 | 299 |
|
307 | 300 | constexpr std::string_view get_default_normalization() const { |
308 | 301 | return DEFAULT_NORMALIZATION; |
@@ -480,9 +473,7 @@ class unknown_md_t { |
480 | 473 | void print(std::ostream& os) const { |
481 | 474 | os << "unknown_md_t(len=" << payload.size() << ")"; |
482 | 475 | } |
483 | | - void dump(ceph::Formatter* f) const { |
484 | | - f->dump_bool("length", payload.size()); |
485 | | - } |
| 476 | + void dump(ceph::Formatter* f) const; |
486 | 477 |
|
487 | 478 | private: |
488 | 479 | std::vector<uint8_t,Allocator<uint8_t>> payload; |
@@ -557,12 +548,7 @@ struct optmetadata_singleton { |
557 | 548 | std::visit([&os](auto& o) { o.print(os); }, optmetadata); |
558 | 549 | os << ")"; |
559 | 550 | } |
560 | | - void dump(ceph::Formatter* f) const { |
561 | | - f->dump_int("kind", u64kind); |
562 | | - f->open_object_section("metadata"); |
563 | | - std::visit([f](auto& o) { o.dump(f); }, optmetadata); |
564 | | - f->close_section(); |
565 | | - } |
| 551 | + void dump(ceph::Formatter* f) const; |
566 | 552 |
|
567 | 553 | void encode(ceph::buffer::list& bl, uint64_t features) const { |
568 | 554 | // no versioning, use optmetadata |
@@ -608,14 +594,7 @@ struct optmetadata_multiton { |
608 | 594 | void print(std::ostream& os) const { |
609 | 595 | os << "optm(len=" << opts.size() << " " << opts << ")"; |
610 | 596 | } |
611 | | - void dump(ceph::Formatter* f) const { |
612 | | - f->dump_bool("length", opts.size()); |
613 | | - f->open_array_section("opts"); |
614 | | - for (auto& opt : opts) { |
615 | | - f->dump_object("opt", opt); |
616 | | - } |
617 | | - f->close_section(); |
618 | | - } |
| 597 | + void dump(ceph::Formatter* f) const; |
619 | 598 |
|
620 | 599 | bool has_opt(optkind_t kind) const { |
621 | 600 | auto f = [kind](auto& o) { |
@@ -1149,91 +1128,6 @@ void inode_t<Allocator>::decode(ceph::buffer::list::const_iterator &p) |
1149 | 1128 | DECODE_FINISH(p); |
1150 | 1129 | } |
1151 | 1130 |
|
1152 | | -template<template<typename> class Allocator> |
1153 | | -void inode_t<Allocator>::dump(ceph::Formatter *f) const |
1154 | | -{ |
1155 | | - f->dump_unsigned("ino", ino); |
1156 | | - f->dump_unsigned("rdev", rdev); |
1157 | | - f->dump_stream("ctime") << ctime; |
1158 | | - f->dump_stream("btime") << btime; |
1159 | | - f->dump_unsigned("mode", mode); |
1160 | | - f->dump_unsigned("uid", uid); |
1161 | | - f->dump_unsigned("gid", gid); |
1162 | | - f->dump_unsigned("nlink", nlink); |
1163 | | - |
1164 | | - f->open_object_section("dir_layout"); |
1165 | | - ::dump(dir_layout, f); |
1166 | | - f->close_section(); |
1167 | | - |
1168 | | - f->dump_object("layout", layout); |
1169 | | - |
1170 | | - f->open_array_section("old_pools"); |
1171 | | - for (const auto &p : old_pools) { |
1172 | | - f->dump_int("pool", p); |
1173 | | - } |
1174 | | - f->close_section(); |
1175 | | - |
1176 | | - f->dump_unsigned("size", size); |
1177 | | - f->dump_unsigned("truncate_seq", truncate_seq); |
1178 | | - f->dump_unsigned("truncate_size", truncate_size); |
1179 | | - f->dump_unsigned("truncate_from", truncate_from); |
1180 | | - f->dump_unsigned("truncate_pending", truncate_pending); |
1181 | | - f->dump_stream("mtime") << mtime; |
1182 | | - f->dump_stream("atime") << atime; |
1183 | | - f->dump_unsigned("time_warp_seq", time_warp_seq); |
1184 | | - f->dump_unsigned("change_attr", change_attr); |
1185 | | - f->dump_int("export_pin", export_pin); |
1186 | | - f->dump_float("export_ephemeral_random_pin", export_ephemeral_random_pin); |
1187 | | - f->dump_bool("export_ephemeral_distributed_pin", get_ephemeral_distributed_pin()); |
1188 | | - f->dump_bool("quiesce_block", get_quiesce_block()); |
1189 | | - |
1190 | | - f->open_array_section("client_ranges"); |
1191 | | - for (const auto &p : client_ranges) { |
1192 | | - f->open_object_section("client"); |
1193 | | - f->dump_unsigned("client", p.first.v); |
1194 | | - p.second.dump(f); |
1195 | | - f->close_section(); |
1196 | | - } |
1197 | | - f->close_section(); |
1198 | | - |
1199 | | - f->open_object_section("dirstat"); |
1200 | | - dirstat.dump(f); |
1201 | | - f->close_section(); |
1202 | | - |
1203 | | - f->open_object_section("rstat"); |
1204 | | - rstat.dump(f); |
1205 | | - f->close_section(); |
1206 | | - |
1207 | | - f->open_object_section("accounted_rstat"); |
1208 | | - accounted_rstat.dump(f); |
1209 | | - f->close_section(); |
1210 | | - |
1211 | | - f->dump_unsigned("version", version); |
1212 | | - f->dump_unsigned("file_data_version", file_data_version); |
1213 | | - f->dump_unsigned("xattr_version", xattr_version); |
1214 | | - f->dump_unsigned("backtrace_version", backtrace_version); |
1215 | | - f->dump_unsigned("inline_data_version", inline_data.version); |
1216 | | - f->dump_unsigned("inline_data_length", inline_data.length()); |
1217 | | - |
1218 | | - f->dump_string("stray_prior_path", stray_prior_path); |
1219 | | - f->dump_unsigned("max_size_ever", max_size_ever); |
1220 | | - |
1221 | | - f->open_object_section("quota"); |
1222 | | - quota.dump(f); |
1223 | | - f->close_section(); |
1224 | | - |
1225 | | - f->dump_object("optmetadata", optmetadata); |
1226 | | - |
1227 | | - f->dump_stream("last_scrub_stamp") << last_scrub_stamp; |
1228 | | - f->dump_unsigned("last_scrub_version", last_scrub_version); |
1229 | | - f->dump_unsigned("remote_ino", remote_ino); |
1230 | | - f->open_array_section("referent_inodes"); |
1231 | | - for (const auto &ri : referent_inodes) { |
1232 | | - f->dump_unsigned("referent_inode", ri); |
1233 | | - } |
1234 | | - f->close_section(); |
1235 | | -} |
1236 | | - |
1237 | 1131 | template<template<typename> class Allocator> |
1238 | 1132 | void inode_t<Allocator>::generate_test_instances(std::list<inode_t*>& ls) |
1239 | 1133 | { |
|
0 commit comments