From: Brad Hubbard Date: Fri, 8 Mar 2019 01:31:32 +0000 (+1000) Subject: src/tools/kvstore_tool.cc: Move bluestore start-up code X-Git-Tag: v14.1.1~10^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26828%2Fhead;p=ceph.git src/tools/kvstore_tool.cc: Move bluestore start-up code Move this code into a separate function to avoid ICE. Fixes: http://tracker.ceph.com/issues/38633 Signed-off-by: Brad Hubbard --- diff --git a/src/tools/kvstore_tool.cc b/src/tools/kvstore_tool.cc index 2d94e610c73..7ed6c9e2d09 100644 --- a/src/tools/kvstore_tool.cc +++ b/src/tools/kvstore_tool.cc @@ -15,12 +15,8 @@ StoreTool::StoreTool(const string& type, const string& path, bool need_open_db) { if (type == "bluestore-kv") { #ifdef WITH_BLUESTORE - auto bluestore = new BlueStore(g_ceph_context, path); - KeyValueDB *db_ptr; - if (int r = bluestore->start_kv_only(&db_ptr, need_open_db); r < 0) { + if (load_bluestore(path, need_open_db) != 0) exit(1); - } - db = decltype(db){db_ptr, Deleter(bluestore)}; #else cerr << "bluestore not compiled in" << std::endl; exit(1); @@ -38,6 +34,18 @@ StoreTool::StoreTool(const string& type, const string& path, bool need_open_db) } } +int StoreTool::load_bluestore(const string& path, bool need_open_db) +{ + auto bluestore = new BlueStore(g_ceph_context, path); + KeyValueDB *db_ptr; + int r = bluestore->start_kv_only(&db_ptr, need_open_db); + if (r < 0) { + return -EINVAL; + } + db = decltype(db){db_ptr, Deleter(bluestore)}; + return 0; +} + uint32_t StoreTool::traverse(const string& prefix, const bool do_crc, const bool do_value_dump, diff --git a/src/tools/kvstore_tool.h b/src/tools/kvstore_tool.h index 296ee5d9a79..3203024728e 100644 --- a/src/tools/kvstore_tool.h +++ b/src/tools/kvstore_tool.h @@ -44,6 +44,7 @@ public: StoreTool(const std::string& type, const std::string& path, bool need_open_db=true); + int load_bluestore(const std::string& path, bool need_open_db); uint32_t traverse(const std::string& prefix, const bool do_crc, const bool do_value_dump,