]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/MDSTableServer: forward-declare MMDSTableRequest 65392/head
authorMax Kellermann <max.kellermann@ionos.com>
Tue, 19 Aug 2025 14:36:44 +0000 (16:36 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Fri, 5 Sep 2025 11:26:01 +0000 (13:26 +0200)
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/mds/MDSTableServer.cc
src/mds/MDSTableServer.h

index 505a686db2caf0ff75fd7587924ee7318c802be9..6bafcdcb162b8bd93b08b90909e339b8d7afc11f 100644 (file)
@@ -21,6 +21,8 @@
 #include "events/ETableServer.h"
 #include "common/debug.h"
 
+#include "messages/MMDSTableRequest.h"
+
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_mds
 #undef dout_prefix
 
 using namespace std;
 
+struct MDSTableServer::notify_info_t {
+  notify_info_t() {}
+  std::set<mds_rank_t> notify_ack_gather;
+  mds_rank_t mds;
+  ref_t<MMDSTableRequest> reply = NULL;
+  MDSContext *onfinish = nullptr;
+};
+
+MDSTableServer::MDSTableServer(MDSRank *m, int tab) :
+    MDSTable(m, get_mdstable_name(tab), false), table(tab) {}
+
+MDSTableServer::~MDSTableServer() = default;
+
+MDSTableServer::MDSTableServer(const MDSTableServer &) = default;
+MDSTableServer &MDSTableServer::operator=(const MDSTableServer &) = default;
+
+void MDSTableServer::_note_prepare(mds_rank_t mds, uint64_t reqid, bool replay) {
+  version++;
+  if (replay)
+    projected_version = version;
+  pending_for_mds[version].mds = mds;
+  pending_for_mds[version].reqid = reqid;
+  pending_for_mds[version].tid = version;
+}
+
+void MDSTableServer::_note_commit(uint64_t tid, bool replay) {
+  version++;
+  if (replay)
+    projected_version = version;
+  pending_for_mds.erase(tid);
+}
+
+void MDSTableServer::_note_rollback(uint64_t tid, bool replay) {
+  version++;
+  if (replay)
+    projected_version = version;
+  pending_for_mds.erase(tid);
+}
+
+void MDSTableServer::_note_server_update(bufferlist& bl, bool replay) {
+  version++;
+  if (replay)
+    projected_version = version;
+}
+
+void MDSTableServer::reset_state() {
+  pending_for_mds.clear();
+  ++version;
+}
+
 void MDSTableServer::handle_request(const cref_t<MMDSTableRequest> &req)
 {
   ceph_assert(req->op >= 0);
@@ -297,6 +349,16 @@ void MDSTableServer::_do_server_recovery()
   recovered = true;
 }
 
+void MDSTableServer::encode_state(bufferlist& bl) const {
+  encode_server_state(bl);
+  encode(pending_for_mds, bl);
+}
+
+void MDSTableServer::decode_state(bufferlist::const_iterator& bl) {
+  decode_server_state(bl);
+  decode(pending_for_mds, bl);
+}
+
 void MDSTableServer::finish_recovery(set<mds_rank_t>& active)
 {
   dout(7) << __func__ << dendl;
index 6d84374a152e0bda576bbd1ae205917ea4686023..29cd999eaa372a1e8872bec839b0969fd0131f4e 100644 (file)
 #include "mdstypes.h" // for mds_table_pending_t
 #include "mds_table_types.h" // for get_mdstable_name()
 
-#include "messages/MMDSTableRequest.h"
-
 #include "common/ref.h" // for cref_t
 
 class MDSContext;
+class MMDSTableRequest;
 
 class MDSTableServer : public MDSTable {
 public:
   friend class C_ServerRecovery;
 
-  MDSTableServer(MDSRank *m, int tab) :
-    MDSTable(m, get_mdstable_name(tab), false), table(tab) {}
-  ~MDSTableServer() override {}
+  MDSTableServer(MDSRank *m, int tab);
+  ~MDSTableServer();
+
+  // required by DencoderImplFeatureful::copy()
+  MDSTableServer(const MDSTableServer &);
+  MDSTableServer &operator=(const MDSTableServer &);
 
   virtual void handle_query(const cref_t<MMDSTableRequest> &m) = 0;
   virtual void _prepare(const bufferlist &bl, uint64_t reqid, mds_rank_t bymds, bufferlist& out) = 0;
@@ -44,36 +46,12 @@ public:
   virtual void _server_update(bufferlist& bl) { ceph_abort(); }
   virtual bool _notify_prep(version_t tid) { return false; };
 
-  void _note_prepare(mds_rank_t mds, uint64_t reqid, bool replay=false) {
-    version++;
-    if (replay)
-      projected_version = version;
-    pending_for_mds[version].mds = mds;
-    pending_for_mds[version].reqid = reqid;
-    pending_for_mds[version].tid = version;
-  }
-  void _note_commit(uint64_t tid, bool replay=false) {
-    version++;
-    if (replay)
-      projected_version = version;
-    pending_for_mds.erase(tid);
-  }
-  void _note_rollback(uint64_t tid, bool replay=false) {
-    version++;
-    if (replay)
-      projected_version = version;
-    pending_for_mds.erase(tid);
-  }
-  void _note_server_update(bufferlist& bl, bool replay=false) {
-    version++;
-    if (replay)
-      projected_version = version;
-  }
-
-  void reset_state() override {
-    pending_for_mds.clear();
-    ++version;
-  }
+  void _note_prepare(mds_rank_t mds, uint64_t reqid, bool replay=false);
+  void _note_commit(uint64_t tid, bool replay=false);
+  void _note_rollback(uint64_t tid, bool replay=false);
+  void _note_server_update(bufferlist& bl, bool replay=false);
+
+  void reset_state() override;
 
   void handle_request(const cref_t<MMDSTableRequest> &m);
   void do_server_update(bufferlist& bl);
@@ -81,14 +59,8 @@ public:
   virtual void encode_server_state(bufferlist& bl) const = 0;
   virtual void decode_server_state(bufferlist::const_iterator& bl) = 0;
 
-  void encode_state(bufferlist& bl) const override {
-    encode_server_state(bl);
-    encode(pending_for_mds, bl);
-  }
-  void decode_state(bufferlist::const_iterator& bl) override {
-    decode_server_state(bl);
-    decode(pending_for_mds, bl);
-  }
+  void encode_state(bufferlist& bl) const override;
+  void decode_state(bufferlist::const_iterator& bl) override;
 
   // recovery
   void finish_recovery(std::set<mds_rank_t>& active);
@@ -101,13 +73,7 @@ protected:
   bool recovered = false;
   std::set<mds_rank_t> active_clients;
 private:
-  struct notify_info_t {
-    notify_info_t() {}
-    std::set<mds_rank_t> notify_ack_gather;
-    mds_rank_t mds;
-    ref_t<MMDSTableRequest> reply = NULL;
-    MDSContext *onfinish = nullptr;
-  };
+  struct notify_info_t;
 
   friend class C_Prepare;
   friend class C_Commit;