From e43f0c6e47b26647927b851e4d112f4b2bce5802 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Wed, 8 Nov 2017 15:14:54 +0800 Subject: [PATCH] tool: ceph-kvstore-tool's store-crc command did not save result to the file as expected "store-crc " command did not save result to , it didn't use argument and alwayls passed a NULL to "st.traverse" function. now we will create file , pass a *ofstream to "st.traverse" function. Fiexes: http://tracker.ceph.com/issues/22092 Signed-off-by: Chang Liu --- src/tools/ceph_kvstore_tool.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools/ceph_kvstore_tool.cc b/src/tools/ceph_kvstore_tool.cc index 9319b487f5d..6bc1786409d 100644 --- a/src/tools/ceph_kvstore_tool.cc +++ b/src/tools/ceph_kvstore_tool.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -558,8 +559,13 @@ int main(int argc, const char *argv[]) } } else if (cmd == "store-crc") { - uint32_t crc = st.traverse(string(), true, NULL); - std::cout << "store at '" << path << "' crc " << crc << std::endl; + if (argc < 4) { + usage(argv[0]); + return 1; + } + std::ofstream fs(argv[4]); + uint32_t crc = st.traverse(string(), true, &fs); + std::cout << "store at '" << argv[4] << "' crc " << crc << std::endl; } else if (cmd == "compact") { st.compact(); -- 2.39.5