From 9272f4f90276cad2df2ff03b30631f7fb44b53c7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 30 Mar 2017 16:37:22 -0400 Subject: [PATCH] ceph-bluestore-tool: add fsck Signed-off-by: Sage Weil --- src/os/bluestore/bluestore_tool.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/bluestore_tool.cc b/src/os/bluestore/bluestore_tool.cc index 6174ed55e008..aa6be877d6b8 100644 --- a/src/os/bluestore/bluestore_tool.cc +++ b/src/os/bluestore/bluestore_tool.cc @@ -31,16 +31,18 @@ int main(int argc, char **argv) vector devs; string path; string action; + bool fsck_deep; po::options_description po_options("Options"); po_options.add_options() ("help,h", "produce help message") ("path", po::value(&path), "bluestore path") ("out-dir", po::value(&out_dir), "output directory") ("dev", po::value>(&devs), "device(s)") + ("deep", po::value(&fsck_deep), "deep fsck (read all data)") ; po::options_description po_positional("Positional options"); po_positional.add_options() - ("command", po::value(&action), "show-label, bluefs-export") + ("command", po::value(&action), "fsck, bluefs-export, show-label") ; po::options_description po_all("All options"); po_all.add(po_options).add(po_positional); @@ -104,7 +106,16 @@ int main(int argc, char **argv) cout << "action " << action << std::endl; - if (action == "show-label") { + if (action == "fsck" || + action == "fsck-deep") { + BlueStore bluestore(cct.get(), path); + int r = bluestore.fsck(fsck_deep); + if (r < 0) { + cerr << "error from fsck: " << cpp_strerror(r) << std::endl; + return 1; + } + } + else if (action == "show-label") { JSONFormatter jf(true); jf.open_array_section("devices"); for (auto& i : devs) { -- 2.47.3