f->close_section();
}
+void BlueFS::dump_block_extents(ostream& out)
+{
+ for (unsigned i = 0; i < MAX_BDEV; ++i) {
+ if (!bdev[i]) {
+ continue;
+ }
+ out << i << " : size 0x" << std::hex << bdev[i]->get_size()
+ << " : own 0x" << block_all[i] << std::dec << "\n";
+ }
+}
void BlueFS::get_usage(vector<pair<uint64_t,uint64_t>> *usage)
{
void get_usage(vector<pair<uint64_t,uint64_t>> *usage); // [<free,total> ...]
void dump_perf_counters(Formatter *f);
+ void dump_block_extents(ostream& out);
+
/// get current extents that we own for given block device
int get_block_extents(unsigned id, interval_set<uint64_t> *extents);
;
po::options_description po_positional("Positional options");
po_positional.add_options()
- ("command", po::value<string>(&action), "fsck, repair, bluefs-export, show-label")
+ ("command", po::value<string>(&action), "fsck, repair, bluefs-export, bluefs-bdev-sizes, show-label")
;
po::options_description po_all("All options");
po_all.add(po_options).add(po_positional);
}
}
}
+ if (action == "bluefs-bdev-sizes") {
+ if (path.empty()) {
+ cerr << "must specify bluestore path" << std::endl;
+ exit(EXIT_FAILURE);
+ }
+ cout << "infering bluefs devices from bluestore path" << std::endl;
+ for (auto fn : {"block", "block.wal", "block.db"}) {
+ string p = path + "/" + fn;
+ struct stat st;
+ if (::stat(p.c_str(), &st) == 0) {
+ devs.push_back(p);
+ }
+ }
+ }
vector<const char*> args;
for (auto& i : ceph_option_strings) {
jf.close_section();
jf.flush(cout);
}
+ else if (action == "bluefs-bdev-sizes") {
+ BlueFS *fs = open_bluefs(cct.get(), path, devs);
+ fs->dump_block_extents(cout);
+ delete fs;
+ }
else if (action == "bluefs-export") {
BlueFS *fs = open_bluefs(cct.get(), path, devs);