]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mds/MDCache.h
update sources to v12.1.0
[ceph.git] / ceph / src / mds / MDCache.h
index 28ebc48ec8a661068912a80125e3b9b4f78a29d6..768f4cc9277e88d0ba5cfe374e5879fde5c325e7 100644 (file)
@@ -114,6 +114,7 @@ class MDCache {
 
   // -- my cache --
   LRU lru;   // dentry lru for expiring items from cache
+  LRU bottom_lru; // dentries that should be trimmed ASAP
  protected:
   ceph::unordered_map<vinodeno_t,CInode*> inode_map;  // map of inodes by ino
   CInode *root;                            // root inode
@@ -154,6 +155,8 @@ public:
   }
 
   void maybe_eval_stray(CInode *in, bool delay=false);
+  void clear_dirty_bits_for_stray(CInode* diri);
+
   bool is_readonly() { return readonly; }
   void force_readonly();
 
@@ -193,6 +196,11 @@ public:
     stray_manager.notify_stray_created();
   }
 
+  void eval_remote(CDentry *dn)
+  {
+    stray_manager.eval_remote(dn);
+  }
+
   // -- client caps --
   uint64_t              last_cap_id;
   
@@ -206,20 +214,20 @@ public:
     frag_t frag;
     snapid_t snap;
     filepath want_path;
-    MDSCacheObject *base;
+    CInode *basei;
     bool want_base_dir;
     bool want_xlocked;
 
     discover_info_t() :
-      tid(0), mds(-1), snap(CEPH_NOSNAP), base(NULL),
+      tid(0), mds(-1), snap(CEPH_NOSNAP), basei(NULL),
       want_base_dir(false), want_xlocked(false) {}
     ~discover_info_t() {
-      if (base)
-       base->put(MDSCacheObject::PIN_DISCOVERBASE);
+      if (basei)
+       basei->put(MDSCacheObject::PIN_DISCOVERBASE);
     }
-    void pin_base(MDSCacheObject *b) {
-      base = b;
-      base->get(MDSCacheObject::PIN_DISCOVERBASE);
+    void pin_base(CInode *b) {
+      basei = b;
+      basei->get(MDSCacheObject::PIN_DISCOVERBASE);
     }
   };
 
@@ -491,6 +499,7 @@ protected:
   bool rejoins_pending;
   set<mds_rank_t> rejoin_gather;      // nodes from whom i need a rejoin
   set<mds_rank_t> rejoin_sent;        // nodes i sent a rejoin to
+  set<mds_rank_t> rejoin_ack_sent;    // nodes i sent a rejoin to
   set<mds_rank_t> rejoin_ack_gather;  // nodes from whom i need a rejoin ack
   map<mds_rank_t,map<inodeno_t,map<client_t,Capability::Import> > > rejoin_imported_caps;
   map<inodeno_t,pair<mds_rank_t,map<client_t,Capability::Export> > > rejoin_slave_exports;
@@ -766,28 +775,19 @@ public:
   }
 public:
   void touch_dentry(CDentry *dn) {
-    // touch ancestors
-    if (dn->get_dir()->get_inode()->get_projected_parent_dn())
-      touch_dentry(dn->get_dir()->get_inode()->get_projected_parent_dn());
-    
-    // touch me
-    if (dn->is_auth())
-      lru.lru_touch(dn);
-    else
-      lru.lru_midtouch(dn);
+    if (dn->state_test(CDentry::STATE_BOTTOMLRU)) {
+      bottom_lru.lru_midtouch(dn);
+    } else {
+      if (dn->is_auth())
+       lru.lru_touch(dn);
+      else
+       lru.lru_midtouch(dn);
+    }
   }
   void touch_dentry_bottom(CDentry *dn) {
+    if (dn->state_test(CDentry::STATE_BOTTOMLRU))
+      return;
     lru.lru_bottouch(dn);
-    if (dn->get_projected_linkage()->is_primary() &&
-       dn->get_dir()->inode->is_stray()) {
-      CInode *in = dn->get_projected_linkage()->get_inode();
-      if (in->has_dirfrags()) {
-       list<CDir*> ls;
-       in->get_dirfrags(ls);
-       for (list<CDir*>::iterator p = ls.begin(); p != ls.end(); ++p)
-         (*p)->touch_dentries_bottom();
-      }
-    }
   }
 protected:
 
@@ -976,7 +976,6 @@ public:
 
   // -- stray --
 public:
-  void eval_remote(CDentry *dn);
   void fetch_backtrace(inodeno_t ino, int64_t pool, bufferlist& bl, Context *fin);
   uint64_t get_num_strays() const { return stray_manager.get_num_strays(); }
 
@@ -1122,14 +1121,14 @@ public:
   void discard_delayed_expire(CDir *dir);
 
 protected:
-  void dump_cache(const char *fn, Formatter *f,
+  int dump_cache(const char *fn, Formatter *f,
                  const std::string& dump_root = "",
                  int depth = -1);
 public:
-  void dump_cache() {dump_cache(NULL, NULL);}
-  void dump_cache(const std::string &filename);
-  void dump_cache(Formatter *f);
-  void dump_cache(const std::string& dump_root, int depth, Formatter *f);
+  int dump_cache() { return dump_cache(NULL, NULL); }
+  int dump_cache(const std::string &filename);
+  int dump_cache(Formatter *f);
+  int dump_cache(const std::string& dump_root, int depth, Formatter *f);
 
   void dump_resolve_status(Formatter *f) const;
   void dump_rejoin_status(Formatter *f) const;