log_seq = 0;
FileRef log_file;
- if (noop) {
- log_file = new File;
+ log_file = _get_file(1);
+ if (!noop) {
+ log_file->fnode = super.log_fnode;
} else {
- log_file = _get_file(1);
+ // do not use fnode from superblock in 'noop' mode - log_file's one should
+ // be fine and up-to-date
+ assert(log_file->fnode.ino == 1);
+ assert(log_file->fnode.extents.size() != 0);
}
- log_file->fnode = super.log_fnode;
dout(10) << __func__ << " log_fnode " << super.log_fnode << dendl;
if (unlikely(to_stdout)) {
std::cout << " log_fnode " << super.log_fnode << std::endl;
return 0;
}
-int BlueFS::log_dump(
- CephContext *cct,
- const string& path,
- const vector<string>& devs)
+int BlueFS::log_dump()
{
- int r = _open_super();
- if (r < 0) {
- derr << __func__ << " failed to open super: " << cpp_strerror(r) << dendl;
- return r;
- }
-
// only dump log file's content
- r = _replay(true, true);
+ int r = _replay(true, true);
if (r < 0) {
derr << __func__ << " failed to replay log: " << cpp_strerror(r) << dendl;
return r;
int mount();
void umount();
- int log_dump(
- CephContext *cct,
- const string& path,
- const vector<string>& devs);
+ int log_dump();
void collect_metadata(map<string,string> *pm, unsigned skip_bdev_id);
void get_devices(set<string> *ls);
}
}
-void log_dump(
+BlueFS *open_bluefs(
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->log_dump(cct, path, devs);
+ int r = fs->mount();
if (r < 0) {
- cerr << "log_dump failed" << ": "
- << cpp_strerror(r) << std::endl;
+ cerr << "unable to mount bluefs: " << cpp_strerror(r)
+ << std::endl;
exit(EXIT_FAILURE);
}
-
- delete fs;
+ return fs;
}
-BlueFS *open_bluefs(
+void log_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->mount();
+ BlueFS* fs = open_bluefs(cct, path, devs);
+ int r = fs->log_dump();
if (r < 0) {
- cerr << "unable to mount bluefs: " << cpp_strerror(r)
- << std::endl;
+ cerr << "log_dump failed" << ": "
+ << cpp_strerror(r) << std::endl;
exit(EXIT_FAILURE);
}
- return fs;
+
+ delete fs;
}
void inferring_bluefs_devices(vector<string>& devs, std::string& path)