]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-bluestore-tool: add 'bluefs-bdev-expand' to expand wal or db usage
authorSage Weil <sage@redhat.com>
Thu, 7 Sep 2017 22:27:20 +0000 (18:27 -0400)
committerSage Weil <sage@redhat.com>
Thu, 14 Sep 2017 16:15:01 +0000 (12:15 -0400)
If you are using the wal or db devices, this will expand bluefs's usage to
include the entire block device.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/bluestore_tool.cc

index ee4ba5839a599864e4a9b71bd4f229f0c0b6f029..a50f9e67ea969f18acd88598ba1c68f2715bd070 100644 (file)
@@ -139,7 +139,7 @@ int main(int argc, char **argv)
     ;
   po::options_description po_positional("Positional options");
   po_positional.add_options()
-    ("command", po::value<string>(&action), "fsck, repair, bluefs-export, bluefs-bdev-sizes, show-label")
+    ("command", po::value<string>(&action), "fsck, repair, bluefs-export, bluefs-bdev-sizes, bluefs-bdev-expand, show-label")
     ;
   po::options_description po_all("All options");
   po_all.add(po_options).add(po_positional);
@@ -207,7 +207,7 @@ int main(int argc, char **argv)
       }
     }
   }
-  if (action == "bluefs-bdev-sizes") {
+  if (action == "bluefs-bdev-sizes" || action == "bluefs-bdev-expand") {
     if (path.empty()) {
       cerr << "must specify bluestore path" << std::endl;
       exit(EXIT_FAILURE);
@@ -272,6 +272,23 @@ int main(int argc, char **argv)
     fs->dump_block_extents(cout);
     delete fs;
   }
+  else if (action == "bluefs-bdev-expand") {
+    BlueFS *fs = open_bluefs(cct.get(), path, devs);
+    cout << "start:" << std::endl;
+    fs->dump_block_extents(cout);
+    for (int devid : { BlueFS::BDEV_WAL, BlueFS::BDEV_DB }) {
+      interval_set<uint64_t> before;
+      fs->get_block_extents(devid, &before);
+      uint64_t end = before.range_end();
+      uint64_t size = fs->get_block_device_size(devid);
+      if (end < size) {
+       cout << "expanding dev " << devid << " from 0x" << std::hex
+            << end << " to 0x" << size << std::dec << std::endl;
+       fs->add_block_extent(devid, end, size-end);
+      }
+    }
+    delete fs;
+  }
   else if (action == "bluefs-export") {
     BlueFS *fs = open_bluefs(cct.get(), path, devs);