]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mds/CDentry.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / mds / CDentry.h
index 56aa58c561a9ca2f9ff933e2990f6f1b84608f25..353b5e24aefb8f0d1003e3892752898045c9b0db 100644 (file)
@@ -28,6 +28,7 @@
 #include "include/elist.h"
 #include "include/filepath.h"
 
+#include "BatchOp.h"
 #include "MDSCacheObject.h"
 #include "MDSContext.h"
 #include "SimpleLock.h"
@@ -42,8 +43,6 @@ class LogSegment;
 
 class Session;
 
-
-
 // define an ordering
 bool operator<(const CDentry& l, const CDentry& r);
 
@@ -124,6 +123,10 @@ public:
     linkage.remote_d_type = dt;
   }
 
+  ~CDentry() override {
+    ceph_assert(batch_ops.empty());
+  }
+
   std::string_view pin_name(int p) const override {
     switch (p) {
     case PIN_INODEPIN: return "inodepin";
@@ -243,22 +246,11 @@ public:
   bool is_new() const { return state_test(STATE_NEW); }
   void clear_new() { state_clear(STATE_NEW); }
   
-  // -- replication
-  void encode_replica(mds_rank_t mds, bufferlist& bl, bool need_recover) {
-    __u32 nonce = add_replica(mds);
-    encode(nonce, bl);
-    encode(first, bl);
-    encode(linkage.remote_ino, bl);
-    encode(linkage.remote_d_type, bl);
-    lock.encode_state_for_replica(bl);
-    encode(need_recover, bl);
-  }
-  void decode_replica(bufferlist::const_iterator& p, bool is_new);
-
   // -- exporting
   // note: this assumes the dentry already exists.  
   // i.e., the name is already extracted... so we just need the other state.
   void encode_export(bufferlist& bl) {
+    ENCODE_START(1, 1, bl);
     encode(first, bl);
     encode(state, bl);
     encode(version, bl);
@@ -266,6 +258,7 @@ public:
     encode(lock, bl);
     encode(get_replicas(), bl);
     get(PIN_TEMPEXPORTING);
+    ENCODE_FINISH(bl);
   }
   void finish_export() {
     // twiddle
@@ -280,6 +273,7 @@ public:
     put(PIN_TEMPEXPORTING);
   }
   void decode_import(bufferlist::const_iterator& blp, LogSegment *ls) {
+    DECODE_START(1, blp);
     decode(first, blp);
     __u32 nstate;
     decode(nstate, blp);
@@ -296,6 +290,7 @@ public:
     if (is_replicated())
       get(PIN_REPLICATED);
     replica_nonce = 0;
+    DECODE_FINISH(blp);
   }
 
   // -- locking --
@@ -354,6 +349,7 @@ public:
   LocalLock versionlock; // FIXME referenced containers not in mempool
 
   mempool::mds_co::map<client_t,ClientLease*> client_lease_map;
+  std::map<int, std::unique_ptr<BatchOp>> batch_ops;
 
 
 protected: