// -- 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
}
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();
stray_manager.notify_stray_created();
}
+ void eval_remote(CDentry *dn)
+ {
+ stray_manager.eval_remote(dn);
+ }
+
// -- client caps --
uint64_t last_cap_id;
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);
}
};
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;
}
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:
// -- 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(); }
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;