if (in->is_base()) {
if (in->is_root())
- in->inode_auth = mds_authority_t(mds->whoami, CDIR_AUTH_UNKNOWN);
+ in->inode_auth = mds_authority_t(mds->get_nodeid(), CDIR_AUTH_UNKNOWN);
else
in->inode_auth = mds_authority_t(mds_rank_t(in->ino() - MDS_INO_MDSDIR_OFFSET), CDIR_AUTH_UNKNOWN);
in->open_snaprealm(); // empty snaprealm
// force empty root dir
CDir *rootdir = root->get_or_open_dirfrag(this, frag_t());
- adjust_subtree_auth(rootdir, mds->whoami);
+ adjust_subtree_auth(rootdir, mds->get_nodeid());
rootdir->dir_rep = CDir::REP_ALL; //NONE;
rootdir->fnode.accounted_fragstat = rootdir->fnode.fragstat;
{
// create mds dir
char myname[10];
- snprintf(myname, sizeof(myname), "mds%d", int(mds->whoami));
- CInode *my = create_system_inode(MDS_INO_MDSDIR(mds->whoami), S_IFDIR);
+ snprintf(myname, sizeof(myname), "mds%d", int(mds->get_nodeid()));
+ CInode *my = create_system_inode(MDS_INO_MDSDIR(mds->get_nodeid()), S_IFDIR);
CDir *mydir = my->get_or_open_dirfrag(this, frag_t());
- adjust_subtree_auth(mydir, mds->whoami);
+ adjust_subtree_auth(mydir, mds->get_nodeid());
LogSegment *ls = mds->mdlog->get_current_segment();
// stray dir
for (int i = 0; i < NUM_STRAY; ++i) {
- CInode *stray = create_system_inode(MDS_INO_STRAY(mds->whoami, i), S_IFDIR);
+ CInode *stray = create_system_inode(MDS_INO_STRAY(mds->get_nodeid(), i), S_IFDIR);
CDir *straydir = stray->get_or_open_dirfrag(this, frag_t());
stringstream name;
name << "stray" << i;
void MDCache::open_root_inode(MDSInternalContextBase *c)
{
- if (mds->whoami == mds->mdsmap->get_root()) {
+ if (mds->get_nodeid() == mds->mdsmap->get_root()) {
CInode *in;
in = create_system_inode(MDS_INO_ROOT, S_IFDIR|0755); // initially inaccurate!
in->fetch(c);
void MDCache::open_mydir_inode(MDSInternalContextBase *c)
{
- CInode *in = create_system_inode(MDS_INO_MDSDIR(mds->whoami), S_IFDIR|0755); // initially inaccurate!
+ CInode *in = create_system_inode(MDS_INO_MDSDIR(mds->get_nodeid()), S_IFDIR|0755); // initially inaccurate!
in->fetch(c);
}
open_root_inode(new C_MDS_RetryOpenRoot(this));
return;
}
- if (mds->whoami == mds->mdsmap->get_root()) {
+ if (mds->get_nodeid() == mds->mdsmap->get_root()) {
assert(root->is_auth());
CDir *rootdir = root->get_or_open_dirfrag(this, frag_t());
assert(rootdir);
if (!rootdir->is_subtree_root())
- adjust_subtree_auth(rootdir, mds->whoami);
+ adjust_subtree_auth(rootdir, mds->get_nodeid());
if (!rootdir->is_complete()) {
rootdir->fetch(new C_MDS_RetryOpenRoot(this));
return;
}
if (!myin) {
- CInode *in = create_system_inode(MDS_INO_MDSDIR(mds->whoami), S_IFDIR|0755); // initially inaccurate!
+ CInode *in = create_system_inode(MDS_INO_MDSDIR(mds->get_nodeid()), S_IFDIR|0755); // initially inaccurate!
in->fetch(new C_MDS_RetryOpenRoot(this));
return;
}
CDir *mydir = myin->get_or_open_dirfrag(this, frag_t());
assert(mydir);
- adjust_subtree_auth(mydir, mds->whoami);
+ adjust_subtree_auth(mydir, mds->get_nodeid());
populate_mydir();
}
straydn = mydir->lookup("stray");
if (!straydn || !straydn->get_linkage()->get_inode()) {
- _create_system_file(mydir, name.str().c_str(), create_system_inode(MDS_INO_STRAY(mds->whoami, i), S_IFDIR),
+ _create_system_file(mydir, name.str().c_str(), create_system_inode(MDS_INO_STRAY(mds->get_nodeid(), i), S_IFDIR),
new C_MDS_RetryOpenRoot(this));
return;
}
// so not
// !me, *
- if (dir->get_dir_auth().first != mds->whoami)
+ if (dir->get_dir_auth().first != mds->get_nodeid())
continue;
if (migrator->is_ambiguous_import(dir->dirfrag()) ||
assert(resolve_done == NULL);
resolve_done = resolve_done_;
- if (mds->mdsmap->get_root() != mds->whoami) {
+ if (mds->mdsmap->get_root() != mds->get_nodeid()) {
// if we don't have the root dir, adjust it to UNKNOWN. during
// resolve we want mds0 to explicit claim the portion of it that
// it owns, so that anything beyond its bounds get left as
for (set<mds_rank_t>::iterator p = recovery_set.begin();
p != recovery_set.end();
++p) {
- if (*p == mds->whoami)
+ if (*p == mds->get_nodeid())
continue;
if (mds->is_resolve() || mds->mdsmap->is_resolve(*p))
resolves[*p] = new MMDSResolve;
CDir *dir = p->first;
if (dir->authority().first != who ||
- dir->authority().second == mds->whoami)
+ dir->authority().second == mds->get_nodeid())
continue;
assert(!dir->is_auth());
other_ambiguous_imports.clear();
// my ambiguous imports
- mds_authority_t me_ambig(mds->whoami, mds->whoami);
+ mds_authority_t me_ambig(mds->get_nodeid(), mds->get_nodeid());
while (!my_ambiguous_imports.empty()) {
map<dirfrag_t, vector<dirfrag_t> >::iterator q = my_ambiguous_imports.begin();
CDir *root = get_subtree_root(dir);
if (root != dir)
dout(10) << " subtree root is " << *root << dendl;
- assert(root->dir_auth.first != mds->whoami); // no us!
+ assert(root->dir_auth.first != mds->get_nodeid()); // no us!
try_trim_non_auth_subtree(root);
mds->mdlog->start_submit_entry(new EImportFinish(dir, false));
if (root) {
root->inode_auth.first = mds->mdsmap->get_root();
- bool auth = mds->whoami == root->inode_auth.first;
+ bool auth = mds->get_nodeid() == root->inode_auth.first;
if (auth) {
root->state_set(CInode::STATE_AUTH);
} else {
rejoin_ack_gather.insert(p->first);
mds->send_message_mds(p->second, p->first);
}
- rejoin_ack_gather.insert(mds->whoami); // we need to complete rejoin_gather_finish, too
+ rejoin_ack_gather.insert(mds->get_nodeid()); // we need to complete rejoin_gather_finish, too
rejoins_pending = false;
// nothing?
rejoin_send_acks();
// signal completion of fetches, rejoin_gather_finish, etc.
- assert(rejoin_ack_gather.count(mds->whoami));
- rejoin_ack_gather.erase(mds->whoami);
+ assert(rejoin_ack_gather.count(mds->get_nodeid()));
+ rejoin_ack_gather.erase(mds->get_nodeid());
// did we already get our acks too?
if (rejoin_ack_gather.empty()) {
CDir *subtree = *s;
if (subtree->inode->is_mdsdir()) {
mds_rank_t owner = mds_rank_t(MDS_INO_MDSDIR_OWNER(subtree->inode->ino()));
- if (owner == mds->whoami) {
+ if (owner == mds->get_nodeid()) {
continue;
}
if (max == 0) {
for (set<CInode*>::iterator p = base_inodes.begin();
p != base_inodes.end(); ++p) {
- if (MDS_INO_MDSDIR_OWNER((*p)->ino()) != mds->whoami) {
+ if (MDS_INO_MDSDIR_OWNER((*p)->ino()) != mds->get_nodeid()) {
dout(20) << __func__ << ": maybe trimming base: " << *(*p) << dendl;
if ((*p)->get_num_ref() == 0) {
trim_inode(NULL, *p, NULL, expiremap);
get_subtree_bounds(dir, bounds);
for (set<CDir*>::iterator p = bounds.begin(); p != bounds.end(); ++p) {
CDir *bd = *p;
- if (bd->get_dir_auth().first != mds->whoami && // we are not auth
+ if (bd->get_dir_auth().first != mds->get_nodeid() && // we are not auth
bd->get_num_any() == 0 && // and empty
can_trim_non_auth_dirfrag(bd)) {
CInode *bi = bd->get_inode();
while (true) {
CInode *diri = dir->get_inode();
if (diri->is_base()) {
- if (!diri->is_root() && diri->authority().first != mds->whoami) {
+ if (!diri->is_root() && diri->authority().first != mds->get_nodeid()) {
dout(10) << " closing empty non-auth subtree " << *dir << dendl;
remove_subtree(dir);
dir->mark_clean();
CDir *psub = get_subtree_root(diri->get_parent_dir());
dout(10) << " parent subtree is " << *psub << dendl;
- if (psub->get_dir_auth().first == mds->whoami)
+ if (psub->get_dir_auth().first == mds->get_nodeid())
break; // we are auth, keep.
dout(10) << " closing empty non-auth subtree " << *dir << dendl;
CInode *diri = get_inode(it->first.ino);
if (diri) {
if (mds->is_rejoin() &&
- rejoin_ack_gather.count(mds->whoami) && // haven't sent rejoin ack yet
+ rejoin_ack_gather.count(mds->get_nodeid()) && // haven't sent rejoin ack yet
!diri->is_replica(from)) {
list<CDir*> ls;
diri->get_nested_dirfrags(ls);
fip.tid = tid;
fip.fin = c;
fip.hint = hint;
- fip.checked.insert(mds->whoami);
+ fip.checked.insert(mds->get_nodeid());
_do_find_ino_peer(fip);
}
fip.hint = MDS_RANK_NONE;
} else {
for (set<mds_rank_t>::iterator p = active.begin(); p != active.end(); ++p)
- if (*p != mds->whoami &&
+ if (*p != mds->get_nodeid() &&
fip.checked.count(*p) == 0) {
m = *p;
break;
dout(0) << "WARNING: client specified " << useino << " and i allocated " << in->inode.ino << dendl;
mds->clog->error() << mdr->client_request->get_source()
<< " specified ino " << useino
- << " but mds." << mds->whoami << " allocated " << in->inode.ino << "\n";
+ << " but mds." << mds->get_nodeid() << " allocated " << in->inode.ino << "\n";
//assert(0); // just for now.
}
rdlocks.insert(&srctrace[i]->lock);
xlocks.insert(&srcdn->lock);
mds_rank_t srcdirauth = srcdn->get_dir()->authority().first;
- if (srcdirauth != mds->whoami) {
+ if (srcdirauth != mds->get_nodeid()) {
dout(10) << " will remote_wrlock srcdir scatterlocks on mds." << srcdirauth << dendl;
remote_wrlocks[&srcdn->get_dir()->inode->filelock] = srcdirauth;
remote_wrlocks[&srcdn->get_dir()->inode->nestlock] = srcdirauth;
bool force_journal = false;
if (empty) {
for (list<CDir*>::iterator p = ls.begin(); p != ls.end(); ++p) {
- if ((*p)->is_subtree_root() && (*p)->get_dir_auth().first == mds->whoami) {
+ if ((*p)->is_subtree_root() && (*p)->get_dir_auth().first == mds->get_nodeid()) {
dout(10) << " frag " << (*p)->get_frag() << " is auth subtree dirfrag, will force journal" << dendl;
force_journal = true;
break;
CDir *dir = *p;
for (list<CDir*>::iterator q = subtrees.begin(); q != subtrees.end(); ++q) {
if (dir->contains(*q)) {
- if ((*q)->get_dir_auth().first == mds->whoami) {
+ if ((*q)->get_dir_auth().first == mds->get_nodeid()) {
dout(10) << " frag " << (*p)->get_frag() << " contains (maybe) auth subtree, will force journal "
<< **q << dendl;
force_journal = true;
}
if (srcdn->get_dir()->inode->is_stray() &&
- srcdn->get_dir()->inode->get_stray_owner() == mds->whoami) {
+ srcdn->get_dir()->inode->get_stray_owner() == mds->get_nodeid()) {
// A reintegration event or a migration away from me
dout(20) << __func__ << ": src dentry was a stray, updating stats" << dendl;
mdcache->notify_stray_removed();
}
if (destdn->get_dir()->inode->is_stray() &&
- destdn->get_dir()->inode->get_stray_owner() == mds->whoami) {
+ destdn->get_dir()->inode->get_stray_owner() == mds->get_nodeid()) {
// A stray migration (to me)
dout(20) << __func__ << ": dst dentry was a stray, updating stats" << dendl;
mdcache->notify_stray_created();