ldout(bluefs->cct, 1) << __func__ << " cannot register SocketHook" << dendl;
delete hook;
hook = nullptr;
+ } else {
+ r = admin_socket->register_command("bluestore bluefs stats",
+ "bluestore bluefs stats",
+ hook,
+ "Dump internal statistics for bluefs.");
+ ceph_assert(r == 0);
}
}
return hook;
~SocketHook() {
AdminSocket* admin_socket = bluefs->cct->get_admin_socket();
- int r = admin_socket->unregister_command("bluestore bluefs available");
- ceph_assert(r == 0);
+ admin_socket->unregister_commands(this);
}
private:
SocketHook(BlueFS* bluefs) :
f->close_section();
f->flush(ss);
delete f;
+ } else if (command == "bluestore bluefs stats") {
+ bluefs->dump_block_extents(ss);
+ bluefs->dump_volume_selector(ss);
} else {
ss << "Invalid command" << std::endl;
r = false;
void BlueFS::dump_block_extents(ostream& out)
{
- vselector->dump(cct);
for (unsigned i = 0; i < MAX_BDEV; ++i) {
if (!bdev[i]) {
continue;
_stop_alloc();
goto out;
}
- vselector->dump(cct);
// init freelist
for (auto& p : file_map) {
super = bluefs_super_t();
log_t.clear();
_shutdown_logger();
-
- vselector->dump(cct);
}
int BlueFS::prepare_new_device(int id)
#undef dout_prefix
#define dout_prefix *_dout << "OriginalVolumeSelector: "
-void OriginalVolumeSelector::dump(CephContext* c) {
- ldout(c, 1) << "wal_total:" << wal_total
+void OriginalVolumeSelector::dump(ostream& sout) {
+ sout<< "wal_total:" << wal_total
<< ", db_total:" << db_total
<< ", slow_total:" << slow_total
- << dendl;
+ << std::endl;
}
virtual void sub_usage(void* file_hint, uint64_t fsize) = 0;
virtual uint8_t select_prefer_bdev(void* hint) = 0;
virtual void get_paths(const std::string& base, paths& res) const = 0;
- virtual void dump(CephContext* cct) = 0;
+ virtual void dump(ostream& sout) = 0;
};
class BlueFS;
void set_volume_selector(BlueFSVolumeSelector* s) {
vselector.reset(s);
}
+ void dump_volume_selector(ostream& sout) {
+ vselector->dump(sout);
+ }
void get_vselector_paths(const std::string& base,
BlueFSVolumeSelector::paths& res) const {
return vselector->get_paths(base, res);
uint8_t select_prefer_bdev(void* hint) override;
void get_paths(const std::string& base, paths& res) const override;
- void dump(CephContext* cct) override;
+ void dump(ostream& sout) override;
};
#endif
return r;
}
RocksDBBlueFSVolumeSelector* vselector = nullptr;
- if (bluefs_layout.shared_bdev == BlueFS::BDEV_SLOW) {
+ if (bluefs_shared_bdev == BlueFS::BDEV_SLOW) {
string options = cct->_conf->bluestore_rocksdb_options;
return reinterpret_cast<void*>(res);
}
-#undef dout_prefix
-#define dout_prefix *_dout << "RocksDBBlueFSVolumeSelector: "
-
-void RocksDBBlueFSVolumeSelector::dump(CephContext* c) {
- stringstream matrix_output;
+void RocksDBBlueFSVolumeSelector::dump(ostream& sout) {
auto max_x = per_level_per_dev_usage.get_max_x();
auto max_y = per_level_per_dev_usage.get_max_y();
- matrix_output << "LEVEL, WAL, DB, SLOW, ****, ****, REAL" << std::endl;
+ sout << "RocksDBBlueFSVolumeSelector: wal_total:" << l_totals[LEVEL_WAL - LEVEL_FIRST]
+ << ", db_total:" << l_totals[LEVEL_DB - LEVEL_FIRST]
+ << ", slow_total:" << l_totals[LEVEL_SLOW - LEVEL_FIRST]
+ << ", db_avail:" << db_avail4slow << std::endl
+ << " usage matrix:" << std::endl;
+ sout << "LEVEL, WAL, DB, SLOW, ****, ****, REAL" << std::endl;
for (size_t l = 0; l < max_y; l++) {
switch (l + LEVEL_FIRST) {
case LEVEL_WAL:
- matrix_output << "WAL "; break;
+ sout << "WAL "; break;
case LEVEL_DB:
- matrix_output << "DB "; break;
+ sout << "DB "; break;
case LEVEL_SLOW:
- matrix_output << "SLOW" << " "; break;
+ sout << "SLOW" << " "; break;
case LEVEL_MAX:
- matrix_output << "TOTALS "; break;
+ sout << "TOTALS "; break;
}
for (size_t d = 0; d < max_x - 1; d++) {
- matrix_output << per_level_per_dev_usage.at(d, l) << ",";
+ sout << per_level_per_dev_usage.at(d, l) << ",";
}
- matrix_output << per_level_per_dev_usage.at(max_x - 1, l) << std::endl;
+ sout << per_level_per_dev_usage.at(max_x - 1, l) << std::endl;
}
ceph_assert(max_x == per_level_per_dev_max.get_max_x());
ceph_assert(max_y == per_level_per_dev_max.get_max_y());
- matrix_output << "MAXIMUMS:" << std::endl;
+ sout << "MAXIMUMS:" << std::endl;
for (size_t l = 0; l < max_y; l++) {
switch (l + LEVEL_FIRST) {
case LEVEL_WAL:
- matrix_output << "WAL "; break;
+ sout << "WAL "; break;
case LEVEL_DB:
- matrix_output << "DB "; break;
+ sout << "DB "; break;
case LEVEL_SLOW:
- matrix_output << "SLOW" << " "; break;
+ sout << "SLOW" << " "; break;
case LEVEL_MAX:
- matrix_output << "TOTALS "; break;
+ sout << "TOTALS "; break;
}
for (size_t d = 0; d < max_x - 1; d++) {
- matrix_output << per_level_per_dev_max.at(d, l) << ",";
+ sout << per_level_per_dev_max.at(d, l) << ",";
}
- matrix_output << per_level_per_dev_max.at(max_x - 1, l);
+ sout << per_level_per_dev_max.at(max_x - 1, l);
if (l < max_y - 1) {
- matrix_output << std::endl;
+ sout << std::endl;
}
}
- ldout(c, 1)
- << "wal_total:" << l_totals[LEVEL_WAL - LEVEL_FIRST]
- << ", db_total:" << l_totals[LEVEL_DB - LEVEL_FIRST]
- << ", slow_total:" << l_totals[LEVEL_SLOW - LEVEL_FIRST]
- << ", db_avail:" << db_avail4slow
- << " usage matrix:" << std::endl
- << matrix_output.str()
- << dendl;
}
// =======================================================