Deleted directory inode's dirfrags may contain some null dentries.
When touch_dentry_bottom() is called, also move these null dentries
to the tail of LRU.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
assert(get_num_any() == items.size());
}
+void CDir::touch_dentries_bottom() {
+ dout(12) << "touch_dentries_bottom " << *this << dendl;
+
+ for (CDir::map_t::iterator p = items.begin();
+ p != items.end();
+ ++p)
+ inode->mdcache->touch_dentry_bottom(p->second);
+}
bool CDir::try_trim_snap_dentry(CDentry *dn, const set<snapid_t>& snaps)
{
void remove_null_dentries();
void purge_stale_snap_data(const set<snapid_t>& snaps);
public:
+ void touch_dentries_bottom();
bool try_trim_snap_dentry(CDentry *dn, const set<snapid_t>& snaps);
!in->state_test(CInode::STATE_EXPORTINGCAPS))
migrator->export_caps(in);
- lru.lru_bottouch(straydn); // move stray to end of lru
+ touch_dentry_bottom(straydn); // move stray to end of lru
straydn = NULL;
} else {
assert(!straydn);
assert(dnl->is_null());
// move to bottom of lru
- lru.lru_bottouch(dn);
+ touch_dentry_bottom(dn);
}
}
}
void touch_dentry_bottom(CDentry *dn) {
lru.lru_bottouch(dn);
+ if (dn->get_projected_linkage()->is_primary()) {
+ 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: