]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: show space available from bluestore when dumping bluefs devices.
authorIgor Fedotov <ifedotov@suse.com>
Mon, 16 Mar 2020 13:40:54 +0000 (16:40 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Fri, 17 Apr 2020 10:36:56 +0000 (13:36 +0300)
This effectively allows ceph-bluestore-tool to report space available from bluestore
for bluefs-bdev-sizes command, i.e. estimate how utilized main device is.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit 7662fce0439456cc3aa4da23248321a4ff90745e)

src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/bluestore/bluestore_tool.cc

index 11cd606f589f37ea48a85ce148964a9c665fee62..8b8e9979e950da8ed2ddabd89b87f41c4e298374 100644 (file)
@@ -412,12 +412,22 @@ void BlueFS::dump_block_extents(ostream& out)
     }
     auto owned = get_total(i);
     auto free = get_free(i);
+
     out << i << " : device size 0x" << std::hex << bdev[i]->get_size()
         << " : own 0x" << block_all[i]
         << " = 0x" << owned
         << " : using 0x" << owned - free
-       << std::dec << "(" << byte_u_t(owned - free) << ")"
-        << "\n";
+       << std::dec << "(" << byte_u_t(owned - free) << ")";
+    if (i == BDEV_SLOW) {
+      ceph_assert(slow_dev_expander);
+      int id = _get_slow_device_id();
+      ceph_assert(alloc[id]);
+      free = slow_dev_expander->available_freespace(alloc_size[id]);
+      out << std::hex
+          << " : bluestore has 0x" << free
+          << std::dec << "(" << byte_u_t(free) << ") available";
+    }
+    out << "\n";
   }
 }
 
index 954dffa4531f5f2a97da7754c9b3f819b8aa7bc0..bcb36a5c384be9e3b85889ee7120e9b450e9b3ba 100644 (file)
@@ -6559,6 +6559,15 @@ int BlueStore::expand_devices(ostream& out)
   return r;
 }
 
+int BlueStore::dump_bluefs_sizes(ostream& out)
+{
+  int r = _mount(true);
+  ceph_assert(r == 0);
+  bluefs->dump_block_extents(out);
+  umount();
+  return r;
+}
+
 void BlueStore::set_cache_shards(unsigned num)
 {
   dout(10) << __func__ << " " << num << dendl;
index b6d62669b54a8938ad741ed9a859ba5a27604e93..6f9aec9f8473f64905a345e2e18fe21fb9a4b129 100644 (file)
@@ -2531,6 +2531,8 @@ public:
   int expand_devices(ostream& out);
   string get_device_path(unsigned id);
 
+  int dump_bluefs_sizes(ostream& out);
+
 public:
   int statfs(struct store_statfs_t *buf,
              osd_alert_list_t* alerts = nullptr) override;
index 63db8261f547f4c2766f18d555ceda7d27769332..fc33289bf98ee659c2317c52767bbfc9bde004ab 100644 (file)
@@ -561,9 +561,8 @@ int main(int argc, char **argv)
     }
   }
   else if (action == "bluefs-bdev-sizes") {
-    BlueFS *fs = open_bluefs(cct.get(), path, devs);
-    fs->dump_block_extents(cout);
-    delete fs;
+    BlueStore bluestore(cct.get(), path);
+    bluestore.dump_bluefs_sizes(cout);
   }
   else if (action == "bluefs-bdev-expand") {
     BlueStore bluestore(cct.get(), path);