Modify bluefs-import command so it can properly initialize allocators.
Without allocators initialized, importing file to bluefs did overwrite some random data,
including first block on device.
Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
return 0;
}
+/* gets access to bluefs supporting RocksDB */
+BlueFS* BlueStore::get_bluefs() {
+ return bluefs;
+}
+
int BlueStore::_prepare_db_environment(bool create, bool read_only,
std::string* _fn, std::string* _kv_backend)
{
int open_db_environment(KeyValueDB **pdb, bool to_repair);
int close_db_environment();
+ BlueFS* get_bluefs();
int write_meta(const std::string& key, const std::string& value) override;
int read_meta(const std::string& key, std::string *value) override;
cerr << "open " << input_file.c_str() << " failed: " << cpp_strerror(r) << std::endl;
exit(EXIT_FAILURE);
}
-
- std::unique_ptr<BlueFS> bs{open_bluefs_readonly(cct, path, devs)};
+ BlueStore bluestore(cct, path);
+ KeyValueDB *db_ptr;
+ r = bluestore.open_db_environment(&db_ptr, false);
+ if (r < 0) {
+ cerr << "error preparing db environment: " << cpp_strerror(r) << std::endl;
+ exit(EXIT_FAILURE);
+ }
+ BlueFS* bs = bluestore.get_bluefs();
BlueFS::FileWriter *h;
fs::path file_path(dest_file);
f.close();
bs->fsync(h);
bs->close_writer(h);
- bs->umount();
+ bluestore.close_db_environment();
return;
}