From: Sage Weil Date: Thu, 7 Sep 2017 22:27:20 +0000 (-0400) Subject: ceph-bluestore-tool: add 'bluefs-bdev-expand' to expand wal or db usage X-Git-Tag: v12.2.2~178^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2184e3077caa9de5f21cc901d26f6ecfb76de9e1;p=ceph.git 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 (cherry picked from commit aa4baad529835c1999ff9cc1a2f509c52a0cc699) --- diff --git a/src/os/bluestore/bluestore_tool.cc b/src/os/bluestore/bluestore_tool.cc index ee4ba5839a59..a50f9e67ea96 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);