]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: cleanup some asok commands
authorVenky Shankar <vshankar@redhat.com>
Sun, 26 Aug 2018 12:55:05 +0000 (08:55 -0400)
committerVenky Shankar <vshankar@redhat.com>
Thu, 15 Nov 2018 09:15:13 +0000 (14:45 +0530)
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit 4c03cfd99eb9144e92740345d6874d1f07831b00)

src/mds/MDCache.cc
src/mds/MDCache.h
src/mds/MDSRank.cc

index d9f68ad68cb415e3d79f66da56c46cc69bcde6e5..bc87aef9231871b97a27c3fd4d509c0812f19290 100644 (file)
@@ -12225,7 +12225,7 @@ void MDCache::show_cache()
     show_func(p.second);
 }
 
-int MDCache::cache_status(Formatter *f)
+void MDCache::cache_status(Formatter *f)
 {
   f->open_object_section("cache");
 
@@ -12234,7 +12234,6 @@ int MDCache::cache_status(Formatter *f)
   f->close_section();
 
   f->close_section();
-  return 0;
 }
 
 void MDCache::dump_tree(CInode *in, const int cur_depth, const int max_depth, Formatter *f) 
index 4c1e6c43e5b6849b5becde3ccd60f6697b0c1668..b8633c4945fe15e63f0dd0ec99ea386edc83f369 100644 (file)
@@ -1210,7 +1210,7 @@ public:
   int dump_cache(Formatter *f);
   void dump_tree(CInode *in, const int cur_depth, const int max_depth, Formatter *f);
 
-  int cache_status(Formatter *f);
+  void cache_status(Formatter *f);
 
   void dump_resolve_status(Formatter *f) const;
   void dump_rejoin_status(Formatter *f) const;
index cdf72edd56ad8f10c58b4de428728a57203758b2..be5d186bda3516028bb7fb34f27e8c763a3ca292 100644 (file)
@@ -2128,10 +2128,7 @@ bool MDSRankDispatcher::handle_asok_command(std::string_view command,
     }
   } else if (command == "cache status") {
     Mutex::Locker l(mds_lock);
-    int r = mdcache->cache_status(f);
-    if (r != 0) {
-      ss << "Failed to get cache status: " << cpp_strerror(r);
-    }
+    mdcache->cache_status(f);
   } else if (command == "dump tree") {
     command_dump_tree(cmdmap, ss, f);
   } else if (command == "dump loads") {
@@ -3060,10 +3057,9 @@ bool MDSRankDispatcher::handle_command(
       return true;
     }
 
-    Formatter *f = new JSONFormatter(true);
-    dump_sessions(filter, f);
-    f->flush(*ds);
-    delete f;
+    JSONFormatter f(true);
+    dump_sessions(filter, &f);
+    f.flush(*ds);
     return true;
   } else if (prefix == "session evict" || prefix == "client evict") {
     std::vector<std::string> filter_args;
@@ -3080,10 +3076,9 @@ bool MDSRankDispatcher::handle_command(
     *need_reply = false;
     return true;
   } else if (prefix == "damage ls") {
-    Formatter *f = new JSONFormatter(true);
-    damage_table.dump(f);
-    f->flush(*ds);
-    delete f;
+    JSONFormatter f(true);
+    damage_table.dump(&f);
+    f.flush(*ds);
     return true;
   } else if (prefix == "damage rm") {
     damage_entry_id_t id = 0;