From aa4baad529835c1999ff9cc1a2f509c52a0cc699 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 7 Sep 2017 18:27:20 -0400 Subject: [PATCH] ceph-bluestore-tool: add 'bluefs-bdev-expand' to expand wal or db usage 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 --- src/os/bluestore/bluestore_tool.cc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/bluestore_tool.cc b/src/os/bluestore/bluestore_tool.cc index ee4ba5839a599..a50f9e67ea969 100644 --- a/src/os/bluestore/bluestore_tool.cc +++ b/src/os/bluestore/bluestore_tool.cc @@ -139,7 +139,7 @@ int main(int argc, char **argv) ; po::options_description po_positional("Positional options"); po_positional.add_options() - ("command", po::value(&action), "fsck, repair, bluefs-export, bluefs-bdev-sizes, show-label") + ("command", po::value(&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 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); -- 2.39.5