mds: scan stray dir, eval strays on mds startup

This commit is contained in:
Sage Weil 2010-06-08 13:38:15 -07:00
parent 2e1b0d3590
commit 80c42d0639
3 changed files with 18 additions and 0 deletions

View File

@ -6927,6 +6927,22 @@ void MDCache::_snaprealm_create_finish(MDRequest *mdr, Mutation *mut, CInode *in
// -------------------------------------------------------------------------------
// STRAYS
void MDCache::scan_stray_dir()
{
dout(10) << "scan_stray_dir" << dendl;
list<CDir*> ls;
for (list<CDir*>::iterator p = ls.begin(); p != ls.end(); p++) {
CDir *dir = *p;
for (CDir::map_t::iterator q = dir->items.begin(); q != dir->items.end(); q++) {
CDentry *dn = q->second;
CDentry::linkage_t *dnl = dn->get_projected_linkage();
if (dnl->is_primary())
maybe_eval_stray(dnl->get_inode());
}
}
}
struct C_MDC_EvalStray : public Context {
MDCache *mdcache;
CDentry *dn;

View File

@ -994,6 +994,7 @@ public:
// -- stray --
public:
void scan_stray_dir();
void eval_stray(CDentry *dn);
void eval_remote(CDentry *dn);

View File

@ -1180,6 +1180,7 @@ void MDS::active_start()
mdcache->open_root();
mdcache->clean_open_file_lists();
mdcache->scan_stray_dir();
finish_contexts(waiting_for_replay); // kick waiters
finish_contexts(waiting_for_active); // kick waiters
}