return 0;
}
+int BlueFS::super_dump()
+{
+ // only dump superblock's content
+ _init_logger();
+ int r = _open_super();
+ if (r < 0) {
+ derr << __func__ << " failed to open super: " << cpp_strerror(r) << dendl;
+ return r;
+ }
+ ceph::JSONFormatter f(true);
+ f.open_object_section("superblock");
+ super.dump(&f);
+ f.close_section();
+ f.flush(std::cout);
+
+ _shutdown_logger();
+ super = bluefs_super_t();
+ return r;
+}
+
int BlueFS::log_dump()
{
// only dump log file's content
int prepare_new_device(int id, const bluefs_layout_t& layout);
int log_dump();
+ int super_dump();
void collect_metadata(std::map<std::string,std::string> *pm, unsigned skip_bdev_id);
void get_devices(std::set<std::string> *ls);
delete fs;
}
+void super_dump(
+ CephContext *cct,
+ const string& path,
+ const vector<string>& devs)
+{
+ validate_path(cct, path, true);
+ BlueFS *fs = new BlueFS(cct);
+
+ add_devices(fs, cct, devs);
+ int r = fs->super_dump();
+ if (r < 0) {
+ cerr << "super_dump failed" << ": "
+ << cpp_strerror(r) << std::endl;
+ exit(EXIT_FAILURE);
+ }
+
+ delete fs;
+}
+
void inferring_bluefs_devices(vector<string>& devs, std::string& path)
{
cout << "inferring bluefs devices from bluestore path" << std::endl;
"set-label-key, "
"rm-label-key, "
"prime-osd-dir, "
+ "bluefs-super-dump, "
"bluefs-log-dump, "
"free-dump, "
"free-score, "
}
if (action == "bluefs-export" ||
action == "bluefs-import" ||
+ action == "bluefs-super-dump" ||
action == "bluefs-log-dump") {
if (path.empty()) {
cerr << "must specify bluestore path" << std::endl;
delete fs;
} else if (action == "bluefs-log-dump") {
log_dump(cct.get(), path, devs);
+ } else if (action == "bluefs-super-dump") {
+ super_dump(cct.get(), path, devs);
} else if (action == "bluefs-bdev-new-db" || action == "bluefs-bdev-new-wal") {
map<string, int> cur_devs_map;
bool need_db = action == "bluefs-bdev-new-db";