From: Sage Weil Date: Thu, 30 Mar 2017 20:37:22 +0000 (-0400) Subject: ceph-bluestore-tool: add fsck X-Git-Tag: v12.0.2~185^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F14258%2Fhead;p=ceph.git ceph-bluestore-tool: add fsck Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/bluestore_tool.cc b/src/os/bluestore/bluestore_tool.cc index 6174ed55e00..aa6be877d6b 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) {