From: xie xingguo Date: Wed, 2 Nov 2016 01:19:15 +0000 (+0800) Subject: tools/ceph_objectstore_tool: handle fsck and fsck-deep op in unified path X-Git-Tag: v11.1.0~444^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=69088dc8931b1932a430bda3f1cd74c5b97bf911;p=ceph.git tools/ceph_objectstore_tool: handle fsck and fsck-deep op in unified path https://github.com/ceph/ceph/pull/11724/commits/181e28ba999c4134957f04183bad5c4dfc0e7062 introduces too much code redundancy, this patch simplifies it a little. Signed-off-by: xie xingguo --- diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index c25b5218c41..ab1ae81dc80 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -2594,21 +2594,8 @@ int main(int argc, char **argv) myexit(1); } - if (op == "fsck") { - int r = fs->fsck(false); - if (r < 0) { - cerr << "fsck failed: " << cpp_strerror(r) << std::endl; - myexit(1); - } - if (r > 0) { - cerr << "fsck found " << r << " errors" << std::endl; - myexit(1); - } - cout << "fsck found no errors" << std::endl; - exit(0); - } - if (op == "fsck-deep") { - int r = fs->fsck(true); + if (op == "fsck" || op == "fsck-deep") { + int r = fs->fsck(op == "fsck-deep"); if (r < 0) { cerr << "fsck failed: " << cpp_strerror(r) << std::endl; myexit(1);