le->metablob.add_root(true, in);
}
if (mdir)
- le->metablob.add_dir(mdir, true, true, true); // dirty AND complete AND new
+ le->metablob.add_new_dir(mdir); // dirty AND complete AND new
mds->mdlog->submit_entry(le);
mds->mdlog->wait_for_safe(new C_MDC_CreateSystemFile(this, mut, dn, dpv, fin));
else {
dir->state_set(CDir::STATE_REJOINING);
dir->state_clear(CDir::STATE_AUTH);
+ dir->state_clear(CDir::STATE_COMPLETE);
if (dir->is_dirty())
dir->mark_clean();
}
pf->rstat.sub(in->inode.accounted_rstat);
le->metablob.add_dir_context(dn->dir);
- EMetaBlob::dirlump& dl = le->metablob.add_dir(dn->dir, true, false, false);
+ EMetaBlob::dirlump& dl = le->metablob.add_dir(dn->dir, true);
le->metablob.add_null_dentry(dl, dn, true);
le->metablob.add_destroyed_inode(in->ino());
journal_allocated_inos(mdr, &le->metablob);
mdcache->predirty_journal_parents(mdr, &le->metablob, newi, dn->get_dir(), PREDIRTY_PRIMARY|PREDIRTY_DIR, 1);
le->metablob.add_primary_dentry(dn, true, newi);
- le->metablob.add_dir(newdir, true, true, true); // dirty AND complete AND new
+ le->metablob.add_new_dir(newdir); // dirty AND complete AND new
// issue a cap on the directory
int cmode = CEPH_FILE_MODE_RDWR;
static const int STATE_COMPLETE = (1<<1);
static const int STATE_DIRTY = (1<<2); // dirty due to THIS journal item, that is!
static const int STATE_NEW = (1<<3); // new directory
+ static const int STATE_IMPORTING = (1<<4); // importing directory
//version_t dirv;
fnode_t fnode;
void mark_dirty() { state |= STATE_DIRTY; }
bool is_new() { return state & STATE_NEW; }
void mark_new() { state |= STATE_NEW; }
+ bool is_importing() { return state & STATE_IMPORTING; }
+ void mark_importing() { state |= STATE_IMPORTING; }
list<std::tr1::shared_ptr<fullbit> > &get_dfull() { return dfull; }
list<remotebit> &get_dremote() { return dremote; }
&in->old_inodes)));
}
- dirlump& add_dir(CDir *dir, bool dirty, bool complete=false, bool isnew=false) {
+ dirlump& add_dir(CDir *dir, bool dirty, bool complete=false) {
return add_dir(dir->dirfrag(), dir->get_projected_fnode(), dir->get_projected_version(),
- dirty, complete, isnew);
+ dirty, complete);
}
- dirlump& add_dir(dirfrag_t df, fnode_t *pf, version_t pv, bool dirty, bool complete=false, bool isnew=false) {
+ dirlump& add_new_dir(CDir *dir) {
+ return add_dir(dir->dirfrag(), dir->get_projected_fnode(), dir->get_projected_version(),
+ true, true, true); // dirty AND complete AND new
+ }
+ dirlump& add_import_dir(CDir *dir) {
+ // dirty=false would be okay in some cases
+ return add_dir(dir->dirfrag(), dir->get_projected_fnode(), dir->get_projected_version(),
+ true, dir->is_complete(), false, true);
+ }
+ dirlump& add_dir(dirfrag_t df, fnode_t *pf, version_t pv, bool dirty,
+ bool complete=false, bool isnew=false, bool importing=false) {
if (lump_map.count(df) == 0)
lump_order.push_back(df);
if (complete) l.mark_complete();
if (dirty) l.mark_dirty();
if (isnew) l.mark_new();
+ if (importing) l.mark_importing();
return l;
}