]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: get rid of unused send_command_reply helpers
authorSage Weil <sage@redhat.com>
Wed, 30 Oct 2019 12:31:33 +0000 (07:31 -0500)
committerSage Weil <sage@redhat.com>
Thu, 12 Dec 2019 19:31:26 +0000 (13:31 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mds/MDSDaemon.cc
src/mds/MDSDaemon.h
src/mds/MDSRank.cc
src/mds/MDSRank.h

index a2b519cdb672ab53f0bd430dc92c3a7f9486266b..16722b584a465301824b5a324ab95eca8a541897 100644 (file)
@@ -579,35 +579,6 @@ void MDSDaemon::tick()
   }
 }
 
-void MDSDaemon::send_command_reply(const cref_t<MCommand> &m, MDSRank *mds_rank,
-                                  int r, bufferlist outbl,
-                                  std::string_view outs)
-{
-  auto priv = m->get_connection()->get_priv();
-  auto session = static_cast<Session *>(priv.get());
-  ceph_assert(session != NULL);
-  // If someone is using a closed session for sending commands (e.g.
-  // the ceph CLI) then we should feel free to clean up this connection
-  // as soon as we've sent them a response.
-  const bool live_session =
-    session->get_state_seq() > 0 &&
-    mds_rank &&
-    mds_rank->sessionmap.get_session(session->info.inst.name);
-
-  if (!live_session) {
-    // This session only existed to issue commands, so terminate it
-    // as soon as we can.
-    ceph_assert(session->is_closed());
-    session->get_connection()->mark_disposable();
-  }
-  priv.reset();
-
-  auto reply = make_message<MCommandReply>(r, outs);
-  reply->set_tid(m->get_tid());
-  reply->set_data(outbl);
-  m->get_connection()->send_message2(reply);
-}
-
 void MDSDaemon::handle_command(const cref_t<MCommand> &m)
 {
   auto priv = m->get_connection()->get_priv();
@@ -638,9 +609,27 @@ void MDSDaemon::handle_command(const cref_t<MCommand> &m)
     cct->get_admin_socket()->queue_tell_command(m);
     return;
   }
+
+  // If someone is using a closed session for sending commands (e.g.
+  // the ceph CLI) then we should feel free to clean up this connection
+  // as soon as we've sent them a response.
+  const bool live_session =
+    session->get_state_seq() > 0 &&
+    mds_rank &&
+    mds_rank->sessionmap.get_session(session->info.inst.name);
+
+  if (!live_session) {
+    // This session only existed to issue commands, so terminate it
+    // as soon as we can.
+    ceph_assert(session->is_closed());
+    session->get_connection()->mark_disposable();
+  }
   priv.reset();
 
-  send_command_reply(m, mds_rank, r, outbl, outs);
+  auto reply = make_message<MCommandReply>(r, outs);
+  reply->set_tid(m->get_tid());
+  reply->set_data(outbl);
+  m->get_connection()->send_message2(reply);
 }
 
 const std::vector<MDSDaemon::MDSCommand>& MDSDaemon::get_commands()
index b511e9f16984daef2d7264858884cbf9e6022e90..265a82f65152cdb7d461c4750e09745cca2b2b9f 100644 (file)
@@ -120,8 +120,6 @@ class MDSDaemon : public Dispatcher {
 
   bool handle_core_message(const cref_t<Message> &m);
   
-  static void send_command_reply(const cref_t<MCommand> &m, MDSRank* mds_rank, int r,
-                                bufferlist outbl, std::string_view outs);
   void handle_command(const cref_t<MCommand> &m);
   void handle_mds_map(const cref_t<MMDSMap> &m);
 
index 6a311120db44314306e8bba6d87d2c0cb0282be9..ad8fccfd455896f8cd05332d57b28a1ffa3b017a 100644 (file)
@@ -2683,29 +2683,6 @@ out:
   on_finish(r, ss.str(), outbl);
 }
 
-class C_MDS_Send_Command_Reply : public MDSInternalContext {
-protected:
-  cref_t<MCommand> m;
-public:
-  C_MDS_Send_Command_Reply(MDSRank *_mds, const cref_t<MCommand> &_m) :
-    MDSInternalContext(_mds), m(_m) {}
-
-  void send(int r, std::string_view ss) {
-    std::stringstream ds;
-    send(r, ss, ds);
-  }
-
-  void send(int r, std::string_view ss, std::stringstream &ds) {
-    bufferlist bl;
-    bl.append(ds);
-    MDSDaemon::send_command_reply(m, mds, r, bl, ss);
-  }
-
-  void finish(int r) override {
-    send(r, "");
-  }
-};
-
 /**
  * This function drops the mds_lock, so don't do anything with
  * MDSRank after calling it (we could have gone into shutdown): just
index ea89c1102cc069a4ffe393b4c8ef56cdb71be8e3..d9bd1dbe5b3dd1904eff069159f9c1154f45d4c7 100644 (file)
@@ -122,7 +122,6 @@ class MonClient;
 class MgrClient;
 class Finisher;
 class ScrubStack;
-class C_MDS_Send_Command_Reply;
 class C_ExecAndReply;
 
 /**