#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_mds
#undef dout_prefix
-#define dout_prefix *_dout << "mds." << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") "
+#define dout_prefix *_dout << "mds." << mdcache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") "
int CDir::num_frozen_trees = 0;
int CDir::num_freezing_trees = 0;
{
protected:
CDir *dir;
- MDSRank* get_mds() override {return dir->cache->mds;}
+ MDSRank* get_mds() override {return dir->mdcache->mds;}
public:
explicit CDirContext(CDir *d) : dir(d) {
{
protected:
CDir *dir;
- MDSRank* get_mds() override {return dir->cache->mds;}
+ MDSRank* get_mds() override {return dir->mdcache->mds;}
public:
explicit CDirIOContext(CDir *d) : dir(d) {
ostream& CDir::print_db_line_prefix(ostream& out)
{
- return out << ceph_clock_now() << " mds." << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") ";
+ return out << ceph_clock_now() << " mds." << mdcache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") ";
}
// -------------------------------------------------------------------
// CDir
-CDir::CDir(CInode *in, frag_t fg, MDCache *mdcache, bool auth) :
- cache(mdcache), inode(in), frag(fg),
+CDir::CDir(CInode *in, frag_t fg, MDCache *mdc, bool auth) :
+ mdcache(mdc), inode(in), frag(fg),
dirty_rstat_inodes(member_offset(CInode, dirty_rstat_item)),
dirty_dentries(member_offset(CDentry, item_dir_dirty)),
item_dirty(this), item_new(this),
lock_caches_with_auth_pins(member_offset(MDLockCache::DirItem, item_dir)),
freezing_inodes(member_offset(CInode, item_freezing_inode)),
dir_rep(REP_NONE),
- pop_me(mdcache->decayrate),
- pop_nested(mdcache->decayrate),
- pop_auth_subtree(mdcache->decayrate),
- pop_auth_subtree_nested(mdcache->decayrate),
- pop_spread(mdcache->decayrate),
+ pop_me(mdc->decayrate),
+ pop_nested(mdc->decayrate),
+ pop_auth_subtree(mdc->decayrate),
+ pop_auth_subtree_nested(mdc->decayrate),
+ pop_spread(mdc->decayrate),
pop_lru_subdirs(member_offset(CInode, item_pop_lru)),
dir_auth(CDIR_AUTH_DEFAULT)
{
{
// FIXME: smarter way to decide if adding 'this' to open file table
if (num_inodes_with_caps == 0 && d > 0)
- cache->open_file_table.add_dirfrag(this);
+ mdcache->open_file_table.add_dirfrag(this);
else if (num_inodes_with_caps > 0 && num_inodes_with_caps == -d)
- cache->open_file_table.remove_dirfrag(this);
+ mdcache->open_file_table.remove_dirfrag(this);
num_inodes_with_caps += d;
ceph_assert(num_inodes_with_caps >= 0);
if (is_auth())
dn->state_set(CDentry::STATE_AUTH);
- cache->bottom_lru.lru_insert_mid(dn);
+ mdcache->bottom_lru.lru_insert_mid(dn);
dn->state_set(CDentry::STATE_BOTTOMLRU);
dn->dir = this;
if (is_auth())
dn->state_set(CDentry::STATE_AUTH);
if (is_auth() || !inode->is_stray()) {
- cache->lru.lru_insert_mid(dn);
+ mdcache->lru.lru_insert_mid(dn);
} else {
- cache->bottom_lru.lru_insert_mid(dn);
+ mdcache->bottom_lru.lru_insert_mid(dn);
dn->state_set(CDentry::STATE_BOTTOMLRU);
}
CDentry* dn = new CDentry(dname, inode->hash_dentry_name(dname), ino, d_type, first, last);
if (is_auth())
dn->state_set(CDentry::STATE_AUTH);
- cache->lru.lru_insert_mid(dn);
+ mdcache->lru.lru_insert_mid(dn);
dn->dir = this;
dn->version = get_projected_version();
dn->mark_clean();
if (dn->state_test(CDentry::STATE_BOTTOMLRU))
- cache->bottom_lru.lru_remove(dn);
+ mdcache->bottom_lru.lru_remove(dn);
else
- cache->lru.lru_remove(dn);
+ mdcache->lru.lru_remove(dn);
delete dn;
// unpin?
dn->get_linkage()->set_remote(ino, d_type);
if (dn->state_test(CDentry::STATE_BOTTOMLRU)) {
- cache->bottom_lru.lru_remove(dn);
- cache->lru.lru_insert_mid(dn);
+ mdcache->bottom_lru.lru_remove(dn);
+ mdcache->lru.lru_insert_mid(dn);
dn->state_clear(CDentry::STATE_BOTTOMLRU);
}
if (dn->state_test(CDentry::STATE_BOTTOMLRU) &&
(is_auth() || !inode->is_stray())) {
- cache->bottom_lru.lru_remove(dn);
- cache->lru.lru_insert_mid(dn);
+ mdcache->bottom_lru.lru_remove(dn);
+ mdcache->lru.lru_insert_mid(dn);
dn->state_clear(CDentry::STATE_BOTTOMLRU);
}
dn->get(CDentry::PIN_INODEPIN);
if (in->state_test(CInode::STATE_TRACKEDBYOFT))
- inode->mdcache->open_file_table.notify_link(in);
+ mdcache->open_file_table.notify_link(in);
if (in->is_any_caps())
adjust_num_inodes_with_caps(1);
unlink_inode_work(dn);
if (adjust_lru && !dn->state_test(CDentry::STATE_BOTTOMLRU)) {
- cache->lru.lru_remove(dn);
- cache->bottom_lru.lru_insert_mid(dn);
+ mdcache->lru.lru_remove(dn);
+ mdcache->bottom_lru.lru_insert_mid(dn);
dn->state_set(CDentry::STATE_BOTTOMLRU);
}
dn->put(CDentry::PIN_INODEPIN);
if (in->state_test(CInode::STATE_TRACKEDBYOFT))
- inode->mdcache->open_file_table.notify_unlink(in);
+ mdcache->open_file_table.notify_unlink(in);
if (in->is_any_caps())
adjust_num_inodes_with_caps(-1);
/* don't maintain bloom filters in standby replay (saves cycles, and also
* avoids need to implement clearing it in EExport for #16924) */
- if (cache->mds->is_standby_replay()) {
+ if (mdcache->mds->is_standby_replay()) {
return;
}
// It's OK to remove lease prematurely because we will never link
// the dentry to inode again.
if (dn->is_any_leases())
- dn->remove_client_leases(cache->mds->locker);
+ dn->remove_client_leases(mdcache->mds->locker);
if (dn->get_num_ref() == 0)
remove_dentry(dn);
} else {
if (dn->get_num_ref() == 0) {
remove_dentry(dn);
if (in)
- cache->remove_inode(in);
+ mdcache->remove_inode(in);
}
}
}
remove_dentry(dn);
if (in) {
dout(10) << " purging snapped " << *in << dendl;
- cache->remove_inode(in);
+ mdcache->remove_inode(in);
}
return true;
}
// create subfrag dirs
int n = 0;
for (const auto& fg : frags) {
- CDir *f = new CDir(inode, fg, cache, is_auth());
+ CDir *f = new CDir(inode, fg, mdcache, is_auth());
f->state_set(state & (MASK_STATE_FRAGMENT_KEPT | STATE_COMPLETE));
f->get_replicas() = get_replicas();
f->pop_me = pop_me;
auto pi = in->project_inode(mut);
pi.inode->version = in->pre_dirty();
- inode->mdcache->project_rstat_inode_to_frag(mut, in, this, 0, 0, nullptr);
+ mdcache->project_rstat_inode_to_frag(mut, in, this, 0, 0, nullptr);
}
state_set(STATE_ASSIMRSTAT);
dout(10) << __func__ << " done" << dendl;
}
if (!dirty_rstat_inodes.empty())
- inode->mdcache->mds->locker->mark_updated_scatterlock(&inode->nestlock);
+ mdcache->mds->locker->mark_updated_scatterlock(&inode->nestlock);
}
if (result < 0)
finish_contexts(g_ceph_context, finished, result);
else
- cache->mds->queue_waiters(finished);
+ mdcache->mds->queue_waiters(finished);
}
MDSContext::vec waiters;
take_waiting(CDir::WAIT_CREATED, waiters);
- cache->mds->queue_waiters(waiters);
+ mdcache->mds->queue_waiters(waiters);
}
void CDir::mark_clean()
auto _fnode = allocate_fnode(*get_fnode());
_fnode->version = pre_dirty();
reset_fnode(std::move(_fnode));
- mark_dirty(cache->mds->mdlog->get_current_segment());
+ mark_dirty(mdcache->mds->mdlog->get_current_segment());
}
void CDir::mark_complete() {
reset_fnode(std::move(_fnode));
if (state_test(STATE_REJOINUNDEF)) {
- ceph_assert(cache->mds->is_rejoin());
+ ceph_assert(mdcache->mds->is_rejoin());
state_clear(STATE_REJOINUNDEF);
- cache->opened_undef_dirfrag(this);
+ mdcache->opened_undef_dirfrag(this);
}
}
mark_complete();
if (c)
- cache->mds->queue_waiter(c);
+ mdcache->mds->queue_waiter(c);
return;
}
auth_pin(this);
state_set(CDir::STATE_FETCHING);
- if (cache->mds->logger) cache->mds->logger->inc(l_mds_dir_fetch);
+ if (mdcache->mds->logger) mdcache->mds->logger->inc(l_mds_dir_fetch);
std::set<dentry_key_t> empty;
_omap_fetch(NULL, empty);
}
auth_pin(this);
- if (cache->mds->logger) cache->mds->logger->inc(l_mds_dir_fetch);
+ if (mdcache->mds->logger) mdcache->mds->logger->inc(l_mds_dir_fetch);
_omap_fetch(c, keys);
}
{
C_IO_Dir_OMAP_Fetched *fin = new C_IO_Dir_OMAP_Fetched(this, c);
object_t oid = get_ondisk_object();
- object_locator_t oloc(cache->mds->mdsmap->get_metadata_pool());
+ object_locator_t oloc(mdcache->mds->mdsmap->get_metadata_pool());
ObjectOperation rd;
rd.omap_get_header(&fin->hdrbl, &fin->ret1);
if (keys.empty()) {
fin->ret3 = -ECANCELED;
}
- cache->mds->objecter->read(oid, oloc, rd, CEPH_NOSNAP, NULL, 0,
- new C_OnFinisher(fin, cache->mds->finisher));
+ mdcache->mds->objecter->read(oid, oloc, rd, CEPH_NOSNAP, NULL, 0,
+ new C_OnFinisher(fin, mdcache->mds->finisher));
}
void CDir::_omap_fetch_more(
{
// we have more omap keys to fetch!
object_t oid = get_ondisk_object();
- object_locator_t oloc(cache->mds->mdsmap->get_metadata_pool());
+ object_locator_t oloc(mdcache->mds->mdsmap->get_metadata_pool());
C_IO_Dir_OMAP_FetchedMore *fin = new C_IO_Dir_OMAP_FetchedMore(this, c);
fin->hdrbl = std::move(hdrbl);
fin->omap.swap(omap);
&fin->omap_more,
&fin->more,
&fin->ret);
- cache->mds->objecter->read(oid, oloc, rd, CEPH_NOSNAP, NULL, 0,
- new C_OnFinisher(fin, cache->mds->finisher));
+ mdcache->mds->objecter->read(oid, oloc, rd, CEPH_NOSNAP, NULL, 0,
+ new C_OnFinisher(fin, mdcache->mds->finisher));
}
CDentry *CDir::_load_dentry(
dn = add_remote_dentry(dname, ino, d_type, first, last);
// link to inode?
- CInode *in = cache->get_inode(ino); // we may or may not have it.
+ CInode *in = mdcache->get_inode(ino); // we may or may not have it.
if (in) {
dn->link_remote(dn->get_linkage(), in);
dout(12) << "_fetched got remote link " << ino << " which we have " << *in << dendl;
if (!dn || undef_inode) {
// add inode
- CInode *in = cache->get_inode(inode_data.inode->ino, last);
+ CInode *in = mdcache->get_inode(inode_data.inode->ino, last);
if (!in || undef_inode) {
if (undef_inode && in)
in->first = first;
else
- in = new CInode(cache, true, first, last);
+ in = new CInode(mdcache, true, first, last);
in->reset_inode(std::move(inode_data.inode));
in->reset_xattrs(std::move(inode_data.xattrs));
in->purge_stale_snap_data(*snaps);
if (!undef_inode) {
- cache->add_inode(in); // add
+ mdcache->add_inode(in); // add
dn = add_primary_dentry(dname, in, first, last); // link
}
dout(12) << "_fetched got " << *dn << " " << *in << dendl;
string dirpath, inopath;
this->inode->make_path_string(dirpath);
in->make_path_string(inopath);
- cache->mds->clog->error() << "loaded dup inode " << inode_data.inode->ino
+ mdcache->mds->clog->error() << "loaded dup inode " << inode_data.inode->ino
<< " [" << first << "," << last << "] v" << inode_data.inode->version
<< " at " << dirpath << "/" << dname
<< ", but inode " << in->vino() << " v" << in->get_version()
void CDir::_omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
bool complete, int r)
{
- LogChannelRef clog = cache->mds->clog;
+ LogChannelRef clog = mdcache->mds->clog;
dout(10) << "_fetched header " << hdrbl.length() << " bytes "
<< omap.size() << " keys for " << *this << dendl;
projected_version = committing_version = committed_version = get_version();
if (state_test(STATE_REJOINUNDEF)) {
- ceph_assert(cache->mds->is_rejoin());
+ ceph_assert(mdcache->mds->is_rejoin());
state_clear(STATE_REJOINUNDEF);
- cache->opened_undef_dirfrag(this);
+ mdcache->opened_undef_dirfrag(this);
}
}
p->first, dname, last, p->second, pos, snaps,
rand_threshold, &force_dirty);
} catch (const buffer::error &err) {
- cache->mds->clog->warn() << "Corrupt dentry '" << dname << "' in "
+ mdcache->mds->clog->warn() << "Corrupt dentry '" << dname << "' in "
"dir frag " << dirfrag() << ": "
<< err.what() << "(" << get_path() << ")";
if (wanted_items.count(mempool::mds_co::string(dname)) > 0 || !complete) {
dout(10) << " touching wanted dn " << *dn << dendl;
- inode->mdcache->touch_dentry(dn);
+ mdcache->touch_dentry(dn);
}
}
CInode *in = undef_inodes.front();
undef_inodes.pop_front();
in->state_clear(CInode::STATE_REJOINUNDEF);
- cache->opened_undef_inode(in);
+ mdcache->opened_undef_inode(in);
}
// dirty myself to remove stale snap dentries
- if (force_dirty && !inode->mdcache->is_readonly())
+ if (force_dirty && !mdcache->is_readonly())
log_mark_dirty();
auth_unpin(this);
std::string path(get_path());
path += "/";
path += dname;
- const bool fatal = cache->mds->damage_table.notify_dentry(
+ const bool fatal = mdcache->mds->damage_table.notify_dentry(
inode->ino(), frag, last, dname, path);
if (fatal) {
- cache->mds->damaged();
+ mdcache->mds->damaged();
ceph_abort(); // unreachable, damaged() respawns us
}
}
void CDir::go_bad(bool complete)
{
dout(10) << __func__ << " " << frag << dendl;
- const bool fatal = cache->mds->damage_table.notify_dirfrag(
+ const bool fatal = mdcache->mds->damage_table.notify_dirfrag(
inode->ino(), frag, get_path());
if (fatal) {
- cache->mds->damaged();
+ mdcache->mds->damaged();
ceph_abort(); // unreachable, damaged() respawns us
}
{
dout(10) << __func__ << dendl;
- unsigned max_write_size = cache->max_dir_commit_size;
+ unsigned max_write_size = mdcache->max_dir_commit_size;
unsigned write_size = 0;
if (op_prio < 0)
C_GatherBuilder gather(g_ceph_context,
new C_OnFinisher(new C_IO_Dir_Committed(this,
get_version()),
- cache->mds->finisher));
+ mdcache->mds->finisher));
SnapContext snapc;
object_t oid = get_ondisk_object();
- object_locator_t oloc(cache->mds->mdsmap->get_metadata_pool());
+ object_locator_t oloc(mdcache->mds->mdsmap->get_metadata_pool());
if (!stale_items.empty()) {
for (const auto &p : stale_items) {
if (!to_remove.empty())
op.omap_rm_keys(to_remove);
- cache->mds->objecter->mutate(oid, oloc, op, snapc,
+ mdcache->mds->objecter->mutate(oid, oloc, op, snapc,
ceph::real_clock::now(),
0, gather.new_sub());
if (!to_remove.empty())
op.omap_rm_keys(to_remove);
- cache->mds->objecter->mutate(oid, oloc, op, snapc,
+ mdcache->mds->objecter->mutate(oid, oloc, op, snapc,
ceph::real_clock::now(),
0, gather.new_sub());
bufferlist snap_blob;
in->encode_snap_blob(snap_blob);
- in->encode_bare(bl, cache->mds->mdsmap->get_up_features(), &snap_blob);
+ in->encode_bare(bl, mdcache->mds->mdsmap->get_up_features(), &snap_blob);
} else {
ceph_assert(!dn->linkage.is_null());
}
state_set(STATE_COMMITTING);
}
- if (cache->mds->logger) cache->mds->logger->inc(l_mds_dir_commit);
+ if (mdcache->mds->logger) mdcache->mds->logger->inc(l_mds_dir_commit);
_omap_commit(op_prio);
}
}
if (r < 0) {
dout(1) << "commit error " << r << " v " << v << dendl;
- cache->mds->clog->error() << "failed to commit dir " << dirfrag() << " object,"
+ mdcache->mds->clog->error() << "failed to commit dir " << dirfrag() << " object,"
<< " errno " << r;
- cache->mds->handle_write_error(r);
+ mdcache->mds->handle_write_error(r);
return;
}
}
MDSContext::vec t;
for (const auto &waiter : it->second)
t.push_back(waiter);
- cache->mds->queue_waiters(t);
+ mdcache->mds->queue_waiters(t);
waiting_for_commit.erase(it);
it = _it;
}
// try drop dentries in this dirfrag if it's about to be purged
if (!inode->is_base() && get_parent_dir()->inode->is_stray() &&
inode->snaprealm)
- cache->maybe_eval_stray(inode, true);
+ mdcache->maybe_eval_stray(inode, true);
// unpin if we kicked the last waiter.
if (were_waiters &&
// did we import some dirty scatterlock data?
if (dirty_old_rstat.size() ||
!(fnode->rstat == fnode->accounted_rstat)) {
- cache->mds->locker->mark_updated_scatterlock(&inode->nestlock);
+ mdcache->mds->locker->mark_updated_scatterlock(&inode->nestlock);
ls->dirty_dirfrag_nest.push_back(&inode->item_dirty_dirfrag_nest);
}
if (!(fnode->fragstat == fnode->accounted_fragstat)) {
- cache->mds->locker->mark_updated_scatterlock(&inode->filelock);
+ mdcache->mds->locker->mark_updated_scatterlock(&inode->filelock);
ls->dirty_dirfrag_dir.push_back(&inode->item_dirty_dirfrag_dir);
}
if (is_dirty_dft()) {
// clear stale dirtydft
state_clear(STATE_DIRTYDFT);
} else {
- cache->mds->locker->mark_updated_scatterlock(&inode->dirfragtreelock);
+ mdcache->mds->locker->mark_updated_scatterlock(&inode->dirfragtreelock);
ls->dirty_dirfrag_dirfragtree.push_back(&inode->item_dirty_dirfrag_dirfragtree);
}
}
if (was_ambiguous && dir_auth.second == CDIR_AUTH_UNKNOWN) {
MDSContext::vec ls;
take_waiting(WAIT_SINGLEAUTH, ls);
- cache->mds->queue_waiters(ls);
+ mdcache->mds->queue_waiters(ls);
}
}
freeze_tree_state = std::make_shared<freeze_tree_state_t>(this);
freeze_tree_state->auth_pins += get_auth_pins() + get_dir_auth_pins();
if (!lock_caches_with_auth_pins.empty())
- cache->mds->locker->invalidate_lock_caches(this);
+ mdcache->mds->locker->invalidate_lock_caches(this);
_walk_tree([this](CDir *dir) {
if (dir->freeze_tree_state)
dir->freeze_tree_state = freeze_tree_state;
freeze_tree_state->auth_pins += dir->get_auth_pins() + dir->get_dir_auth_pins();
if (!dir->lock_caches_with_auth_pins.empty())
- cache->mds->locker->invalidate_lock_caches(dir);
+ mdcache->mds->locker->invalidate_lock_caches(dir);
return true;
}
);
_walk_tree([this, &auth] (CDir *dir) {
if (dir->freeze_tree_state != freeze_tree_state) {
- inode->mdcache->adjust_subtree_auth(dir, auth);
+ mdcache->adjust_subtree_auth(dir, auth);
return false;
}
return true;
ceph_assert(auth.first >= 0);
ceph_assert(auth.second == CDIR_AUTH_UNKNOWN);
auth.second = auth.first;
- inode->mdcache->adjust_subtree_auth(this, auth);
+ mdcache->adjust_subtree_auth(this, auth);
if (!was_subtree)
inode->auth_unpin(this);
} else {
ceph_assert(auth.first >= 0);
ceph_assert(auth.second == auth.first);
auth.second = CDIR_AUTH_UNKNOWN;
- inode->mdcache->adjust_subtree_auth(this, auth);
+ mdcache->adjust_subtree_auth(this, auth);
}
freeze_tree_state.reset();
} else {
auth_unpin(this);
}
- cache->mds->queue_waiters(unfreeze_waiters);
+ mdcache->mds->queue_waiters(unfreeze_waiters);
}
void CDir::adjust_freeze_after_rename(CDir *dir)
unfreeze(dir);
dir->_walk_tree(unfreeze);
- cache->mds->queue_waiters(unfreeze_waiters);
+ mdcache->mds->queue_waiters(unfreeze_waiters);
}
bool CDir::can_auth_pin(int *err_ret) const
} else {
state_set(STATE_FREEZINGDIR);
if (!lock_caches_with_auth_pins.empty())
- cache->mds->locker->invalidate_lock_caches(this);
+ mdcache->mds->locker->invalidate_lock_caches(this);
dout(10) << "freeze_dir + wait " << *this << dendl;
return false;
}
} else {
scrub_infop->pending_scrub_error = true;
if (scrub_infop->header->get_repair())
- cache->repair_dirfrag_stats(this);
+ mdcache->repair_dirfrag_stats(this);
}
return rval;
}
it->second.state = EXPORT_CANCELLED;
dir->unfreeze_tree(); // cancel the freeze
if (dir->is_subtree_root())
- cache->try_subtree_merge(dir);
+ mdcache->try_subtree_merge(dir);
if (notify_peer &&
(!mds->is_cluster_degraded() ||
mds->mdsmap->is_clientreplay_or_active_or_stopping(it->second.peer))) // tell them.
{
// unpin bounds
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
for (set<CDir*>::iterator q = bounds.begin();
q != bounds.end();
++q) {
// notify bystanders
export_notify_abort(dir, it->second, bounds);
// process delayed expires
- cache->process_delayed_expire(dir);
+ mdcache->process_delayed_expire(dir);
}
}
dir->unfreeze_tree();
- cache->try_subtree_merge(dir);
+ mdcache->try_subtree_merge(dir);
if (notify_peer &&
(!mds->is_cluster_degraded() ||
mds->mdsmap->is_clientreplay_or_active_or_stopping(it->second.peer))) // tell them.
if (state == EXPORT_LOCKING || state == EXPORT_DISCOVERING) {
MDRequestRef mdr = static_cast<MDRequestImpl*>(mut.get());
ceph_assert(mdr);
- mds->mdcache->request_kill(mdr);
+ mdcache->request_kill(mdr);
} else if (mut) {
mds->locker->drop_locks(mut.get());
mut->cleanup();
}
- cache->show_subtrees();
+ mdcache->show_subtrees();
maybe_do_queued_export();
}
dir->auth_unpin(this);
}
// send pending import_maps? (these need to go out when all exports have finished.)
- cache->maybe_send_pending_resolves();
+ mdcache->maybe_send_pending_resolves();
if (parent)
child_export_finish(parent, false);
map<dirfrag_t,import_state_t>::iterator next = q;
++next;
dirfrag_t df = q->first;
- CInode *diri = mds->mdcache->get_inode(df.ino);
- CDir *dir = mds->mdcache->get_dirfrag(df);
+ CInode *diri = mdcache->get_inode(df.ino);
+ CDir *dir = mdcache->get_dirfrag(df);
if (q->second.peer == who) {
if (dir)
dout(10) << "import state=prepped : unpinning base+bounds, unfreezing " << *dir << dendl;
{
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
import_remove_pins(dir, bounds);
// adjust auth back to the exporter
- cache->adjust_subtree_auth(dir, q->second.peer);
+ mdcache->adjust_subtree_auth(dir, q->second.peer);
// notify bystanders ; wait in aborting state
q->second.state = IMPORT_ABORTING;
dout(10) << "import state=acking : noting ambiguous import " << *dir << dendl;
{
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
- cache->add_ambiguous_import(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
+ mdcache->add_ambiguous_import(dir, bounds);
}
break;
for (map<dirfrag_t,import_state_t>::iterator p = import_state.begin();
p != import_state.end();
++p) {
- CDir *dir = mds->mdcache->get_dirfrag(p->first);
+ CDir *dir = mdcache->get_dirfrag(p->first);
if (dir) {
dout(10) << " importing from " << p->second.peer
<< ": (" << p->second.state << ") " << get_import_statename(p->second.state)
if (p->second.state == IMPORT_DISCOVERING)
continue;
if (p->second.state == IMPORT_DISCOVERED) {
- CInode *in = cache->get_inode(p->first.ino);
+ CInode *in = mdcache->get_inode(p->first.ino);
ceph_assert(in);
continue;
}
- CDir *dir = cache->get_dirfrag(p->first);
+ CDir *dir = mdcache->get_dirfrag(p->first);
ceph_assert(dir);
if (p->second.state == IMPORT_PREPPING)
continue;
mds_rank_t dest = export_queue.front().second;
export_queue.pop_front();
- CDir *dir = mds->mdcache->get_dirfrag(df);
+ CDir *dir = mdcache->get_dirfrag(df);
if (!dir) continue;
if (!dir->is_auth()) continue;
set<CDir*> wouldbe_bounds;
set<CInode*> bound_inodes;
- cache->get_wouldbe_subtree_bounds(dir, wouldbe_bounds);
+ mdcache->get_wouldbe_subtree_bounds(dir, wouldbe_bounds);
for (auto& bound : wouldbe_bounds)
bound_inodes.insert(bound->get_inode());
for (auto& in : bound_inodes)
} else if (!(mds->is_active() || mds->is_stopping())) {
dout(7) << "Cannot export to mds." << dest << " " << *dir << ": not active" << dendl;
return;
- } else if (mds->mdcache->is_readonly()) {
+ } else if (mdcache->is_readonly()) {
dout(7) << "Cannot export to mds." << dest << " " << *dir << ": read-only FS, no exports for now" << dendl;
return;
} else if (!mds->mdsmap->is_active(dest)) {
if (!(bd->is_frozen() || bd->is_freezing())) {
ceph_assert(bd->is_auth());
dir->state_set(CDir::STATE_AUXSUBTREE);
- mds->mdcache->adjust_subtree_auth(dir, mds->get_nodeid());
+ mdcache->adjust_subtree_auth(dir, mds->get_nodeid());
dout(7) << "create aux subtree " << *bd << " under " << *dir << dendl;
}
}
dir->auth_pin(this);
dir->mark_exporting();
- MDRequestRef mdr = mds->mdcache->request_start_internal(CEPH_MDS_OP_EXPORTDIR);
+ MDRequestRef mdr = mdcache->request_start_internal(CEPH_MDS_OP_EXPORTDIR);
mdr->more()->export_dir = dir;
mdr->pin(dir);
stat.tid = mdr->reqid.tid;
stat.mut = mdr;
- mds->mdcache->dispatch_request(mdr);
+ mdcache->dispatch_request(mdr);
}
/*
ceph_assert(mdr->killed || mdr->aborted);
if (mdr->aborted) {
mdr->aborted = false;
- mds->mdcache->request_kill(mdr);
+ mdcache->request_kill(mdr);
}
return;
}
// dirfrag's portion in the local (auth OR replica) dirfrag.
set<CDir*> wouldbe_bounds;
set<CInode*> bound_inodes;
- cache->get_wouldbe_subtree_bounds(dir, wouldbe_bounds);
+ mdcache->get_wouldbe_subtree_bounds(dir, wouldbe_bounds);
for (auto& bound : wouldbe_bounds)
bound_inodes.insert(bound->get_inode());
for (auto& in : bound_inodes)
sub->auth_pin(this);
sub->mark_exporting();
- MDRequestRef _mdr = mds->mdcache->request_start_internal(CEPH_MDS_OP_EXPORTDIR);
+ MDRequestRef _mdr = mdcache->request_start_internal(CEPH_MDS_OP_EXPORTDIR);
_mdr->more()->export_dir = sub;
_mdr->pin(sub);
stat.tid = _mdr->reqid.tid;
stat.mut = _mdr;
stat.parent = parent;
- mds->mdcache->dispatch_request(_mdr);
+ mdcache->dispatch_request(_mdr);
}
// cancel the original one
if (--parent->pending_children == 0) {
if (parent->restart &&
parent->export_queue_gen == export_queue_gen) {
- CDir *origin = mds->mdcache->get_dirfrag(parent->dirfrag);
+ CDir *origin = mdcache->get_dirfrag(parent->dirfrag);
if (origin && origin->is_auth()) {
dout(7) << "child_export_finish requeue " << *origin << dendl;
export_queue.emplace_front(origin->dirfrag(), parent->dest);
*/
void Migrator::handle_export_discover_ack(const cref_t<MExportDirDiscoverAck> &m)
{
- CDir *dir = cache->get_dirfrag(m->get_dirfrag());
+ CDir *dir = mdcache->get_dirfrag(m->get_dirfrag());
mds_rank_t dest(m->get_source().num());
ceph_assert(dir);
// release locks to avoid deadlock
MDRequestRef mdr = static_cast<MDRequestImpl*>(it->second.mut.get());
ceph_assert(mdr);
- mds->mdcache->request_finish(mdr);
+ mdcache->request_finish(mdr);
it->second.mut.reset();
// freeze the subtree
it->second.state = EXPORT_FREEZING;
// prepend dentry + inode
ceph_assert(cur->inode->is_auth());
bufferlist bl;
- cache->encode_replica_dentry(cur->inode->parent, es.peer, bl);
+ mdcache->encode_replica_dentry(cur->inode->parent, es.peer, bl);
dout(7) << " added " << *cur->inode->parent << dendl;
- cache->encode_replica_inode(cur->inode, es.peer, bl, mds->mdsmap->get_up_features());
+ mdcache->encode_replica_inode(cur->inode, es.peer, bl, mds->mdsmap->get_up_features());
dout(7) << " added " << *cur->inode << dendl;
bl.claim_append(tracebl);
tracebl = std::move(bl);
dirfrags_added.insert(cur->dirfrag());
// prepend dir
- cache->encode_replica_dir(cur, es.peer, bl);
+ mdcache->encode_replica_dir(cur, es.peer, bl);
dout(7) << " added " << *cur << dendl;
bl.claim_append(tracebl);
tracebl = std::move(bl);
if (diri->is_auth())
it->second.mut->auth_pin(diri);
- cache->show_subtrees();
+ mdcache->show_subtrees();
// CDir::_freeze_tree() should have forced it into subtree.
ceph_assert(dir->get_dir_auth() == mds_authority_t(mds->get_nodeid(), mds->get_nodeid()));
// note the bounds.
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
// generate prep message, log entry.
auto prep = make_message<MExportDirPrep>(dir->dirfrag(), it->second.tid);
}
// include base dirfrag
- cache->encode_replica_dir(dir, it->second.peer, prep->basedir);
+ mdcache->encode_replica_dir(dir, it->second.peer, prep->basedir);
/*
* include spanning tree for all nested exports.
void Migrator::handle_export_prep_ack(const cref_t<MExportDirPrepAck> &m)
{
- CDir *dir = cache->get_dirfrag(m->get_dirfrag());
+ CDir *dir = mdcache->get_dirfrag(m->get_dirfrag());
mds_rank_t dest(m->get_source().num());
ceph_assert(dir);
assert (g_conf()->mds_kill_export_at != 5);
// send warnings
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
ceph_assert(it->second.warning_ack_waiting.empty() ||
(it->second.warning_ack_waiting.size() == 1 &&
dout(7) << *dir << " to " << dest << dendl;
- cache->show_subtrees();
+ mdcache->show_subtrees();
it->second.state = EXPORT_EXPORTING;
ceph_assert(g_conf()->mds_kill_export_at != 7);
ceph_assert(dir->is_frozen_tree_root());
// set ambiguous auth
- cache->adjust_subtree_auth(dir, mds->get_nodeid(), dest);
+ mdcache->adjust_subtree_auth(dir, mds->get_nodeid(), dest);
// take away the popularity we're sending.
mds->balancer->subtract_export(dir);
// add bounds to message
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
for (set<CDir*>::iterator p = bounds.begin();
p != bounds.end();
++p)
if (mds->logger) mds->logger->inc(l_mds_exported);
if (mds->logger) mds->logger->inc(l_mds_exported_inodes, num_exported_inodes);
- cache->show_subtrees();
+ mdcache->show_subtrees();
}
subdirs.insert(std::end(subdirs), std::begin(dirs), std::end(dirs));
}
- cache->touch_dentry_bottom(dn); // move dentry to tail of LRU
+ mdcache->touch_dentry_bottom(dn); // move dentry to tail of LRU
++(*num_dentries);
}
*/
void Migrator::handle_export_ack(const cref_t<MExportDirAck> &m)
{
- CDir *dir = cache->get_dirfrag(m->get_dirfrag());
+ CDir *dir = mdcache->get_dirfrag(m->get_dirfrag());
mds_rank_t dest(m->get_source().num());
ceph_assert(dir);
ceph_assert(dir->is_frozen_tree_root()); // i'm exporting!
it->second.state = EXPORT_LOGGINGFINISH;
assert (g_conf()->mds_kill_export_at != 9);
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
// log completion.
// include export bounds, to ensure they're in the journal.
// list us second, them first.
// this keeps authority().first in sync with subtree auth state in the journal.
- cache->adjust_subtree_auth(dir, it->second.peer, mds->get_nodeid());
+ mdcache->adjust_subtree_auth(dir, it->second.peer, mds->get_nodeid());
// log export completion, then finish (unfreeze, trigger finish context, etc.)
mds->mdlog->submit_entry(le, new C_MDS_ExportFinishLogged(this, dir));
set<CInode*> to_eval;
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
// remove exporting pins
std::deque<CDir*> rq;
export_notify_abort(dir, stat, bounds);
// unfreeze tree, with possible subtree merge.
- cache->adjust_subtree_auth(dir, mds->get_nodeid(), mds->get_nodeid());
+ mdcache->adjust_subtree_auth(dir, mds->get_nodeid(), mds->get_nodeid());
// process delayed expires
- cache->process_delayed_expire(dir);
+ mdcache->process_delayed_expire(dir);
dir->unfreeze_tree();
- cache->try_subtree_merge(dir);
+ mdcache->try_subtree_merge(dir);
// revoke/resume stale caps
for (auto in : to_eval) {
mds->locker->issue_caps(in);
}
- cache->show_cache();
+ mdcache->show_cache();
}
// send notifies
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
for (set<mds_rank_t>::iterator p = stat.notify_ack_waiting.begin();
p != stat.notify_ack_waiting.end();
*/
void Migrator::handle_export_notify_ack(const cref_t<MExportDirNotifyAck> &m)
{
- CDir *dir = cache->get_dirfrag(m->get_dirfrag());
+ CDir *dir = mdcache->get_dirfrag(m->get_dirfrag());
mds_rank_t dest(m->get_source().num());
ceph_assert(dir);
mds_rank_t from = mds_rank_t(m->get_source().num());
it->second.peer_imported, finished, &num_dentries);
ceph_assert(!dir->is_auth());
- cache->adjust_subtree_auth(dir, it->second.peer);
+ mdcache->adjust_subtree_auth(dir, it->second.peer);
// unpin bounds
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
for (set<CDir*>::iterator p = bounds.begin();
p != bounds.end();
++p) {
dir->state_clear(CDir::STATE_AUXSUBTREE);
// discard delayed expires
- cache->discard_delayed_expire(dir);
+ mdcache->discard_delayed_expire(dir);
dout(7) << "unfreezing" << dendl;
// unfreeze tree, with possible subtree merge.
// (we do this _after_ removing EXPORTBOUND pins, to allow merges)
dir->unfreeze_tree();
- cache->try_subtree_merge(dir);
+ mdcache->try_subtree_merge(dir);
// no more auth subtree? clear scatter dirty
if (!dir->get_inode()->is_auth() &&
ceph_assert(dir->state_test(CDir::STATE_EXPORTING));
dir->clear_exporting();
- cache->show_subtrees();
+ mdcache->show_subtrees();
audit();
- cache->trim(num_dentries); // try trimming exported dentries
+ mdcache->trim(num_dentries); // try trimming exported dentries
// send pending import_maps?
- mds->mdcache->maybe_send_pending_resolves();
+ mdcache->maybe_send_pending_resolves();
// drop locks, unpin path
if (mut) {
}
C_MDS_ExportDiscoverFactory cf(this, m);
- if (!mds->mdcache->is_open()) {
+ if (!mdcache->is_open()) {
dout(10) << " waiting for root" << dendl;
mds->mdcache->wait_for_open(cf.build());
return;
assert (g_conf()->mds_kill_import_at != 1);
// do we have it?
- CInode *in = cache->get_inode(m->get_dirfrag().ino);
+ CInode *in = mdcache->get_inode(m->get_dirfrag().ino);
if (!in) {
// must discover it!
filepath fpath(m->get_path());
vector<CDentry*> trace;
MDRequestRef null_ref;
- int r = cache->path_traverse(null_ref, cf, fpath,
- MDS_TRAVERSE_DISCOVER | MDS_TRAVERSE_PATH_LOCKED,
- &trace);
+ int r = mdcache->path_traverse(null_ref, cf, fpath,
+ MDS_TRAVERSE_DISCOVER | MDS_TRAVERSE_PATH_LOCKED,
+ &trace);
if (r > 0) return;
if (r < 0) {
dout(7) << "failed to discover or not dir " << m->get_path() << ", NAK" << dendl;
void Migrator::import_reverse_prepping(CDir *dir, import_state_t& stat)
{
set<CDir*> bounds;
- cache->map_dirfrag_set(stat.bound_ls, bounds);
+ mdcache->map_dirfrag_set(stat.bound_ls, bounds);
import_remove_pins(dir, bounds);
import_reverse_final(dir);
}
} else if (it->second.state == IMPORT_DISCOVERING) {
import_reverse_discovering(df);
} else if (it->second.state == IMPORT_DISCOVERED) {
- CInode *in = cache->get_inode(df.ino);
+ CInode *in = mdcache->get_inode(df.ino);
ceph_assert(in);
import_reverse_discovered(df, in);
} else if (it->second.state == IMPORT_PREPPING) {
- CDir *dir = mds->mdcache->get_dirfrag(df);
+ CDir *dir = mdcache->get_dirfrag(df);
ceph_assert(dir);
import_reverse_prepping(dir, it->second);
} else if (it->second.state == IMPORT_PREPPED) {
- CDir *dir = mds->mdcache->get_dirfrag(df);
+ CDir *dir = mdcache->get_dirfrag(df);
ceph_assert(dir);
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
import_remove_pins(dir, bounds);
// adjust auth back to the exportor
- cache->adjust_subtree_auth(dir, it->second.peer);
+ mdcache->adjust_subtree_auth(dir, it->second.peer);
import_reverse_unfreeze(dir);
} else {
ceph_abort_msg("got export_cancel in weird state");
CDir *cur = nullptr;
if (start == 'd') {
- cur = cache->get_dirfrag(df);
+ cur = mdcache->get_dirfrag(df);
ceph_assert(cur);
dout(10) << " had " << *cur << dendl;
} else if (start == 'f') {
- CInode *in = cache->get_inode(df.ino);
+ CInode *in = mdcache->get_inode(df.ino);
ceph_assert(in);
dout(10) << " had " << *in << dendl;
- cache->decode_replica_dir(cur, blp, in, oldauth, finished);
+ mdcache->decode_replica_dir(cur, blp, in, oldauth, finished);
dout(10) << " added " << *cur << dendl;
} else if (start == '-') {
// nothing
while (!blp.end()) {
CDentry *dn = nullptr;
- cache->decode_replica_dentry(dn, blp, cur, finished);
+ mdcache->decode_replica_dentry(dn, blp, cur, finished);
dout(10) << " added " << *dn << dendl;
CInode *in = nullptr;
- cache->decode_replica_inode(in, blp, dn, finished);
+ mdcache->decode_replica_inode(in, blp, dn, finished);
dout(10) << " added " << *in << dendl;
if (blp.end())
break;
- cache->decode_replica_dir(cur, blp, in, oldauth, finished);
+ mdcache->decode_replica_dir(cur, blp, in, oldauth, finished);
dout(10) << " added " << *cur << dendl;
}
ceph_assert(it != import_state.end());
ceph_assert(it->second.state == IMPORT_DISCOVERED);
ceph_assert(it->second.peer == oldauth);
- diri = cache->get_inode(m->get_dirfrag().ino);
+ diri = mdcache->get_inode(m->get_dirfrag().ino);
ceph_assert(diri);
auto p = m->basedir.cbegin();
- cache->decode_replica_dir(dir, p, diri, oldauth, finished);
+ mdcache->decode_replica_dir(dir, p, diri, oldauth, finished);
dout(7) << "on " << *dir << " (first pass)" << dendl;
} else {
if (it == import_state.end() ||
ceph_assert(it->second.state == IMPORT_PREPPING);
ceph_assert(it->second.peer == oldauth);
- dir = cache->get_dirfrag(m->get_dirfrag());
+ dir = mdcache->get_dirfrag(m->get_dirfrag());
ceph_assert(dir);
dout(7) << "on " << *dir << " (subsequent pass)" << dendl;
diri = dir->get_inode();
}
ceph_assert(dir->is_auth() == false);
- cache->show_subtrees();
+ mdcache->show_subtrees();
// build import bound map
map<inodeno_t, fragset_t> import_bound_fragset;
p != import_bound_fragset.end();
++p) {
p->second.simplify();
- CInode *in = cache->get_inode(p->first);
+ CInode *in = mdcache->get_inode(p->first);
ceph_assert(in);
in->get_stickydirs();
dout(7) << " set stickydirs on bound inode " << *in << dendl;
for (map<inodeno_t,fragset_t>::iterator p = import_bound_fragset.begin();
p != import_bound_fragset.end();
++p) {
- CInode *in = cache->get_inode(p->first);
+ CInode *in = mdcache->get_inode(p->first);
ceph_assert(in);
// map fragset into a frag_t list, based on the inode fragtree
dout(10) << " bound inode " << p->first << " fragset " << p->second << " maps to " << leaves << dendl;
for (const auto& leaf : leaves) {
- CDir *bound = cache->get_dirfrag(dirfrag_t(p->first, leaf));
+ CDir *bound = mdcache->get_dirfrag(dirfrag_t(p->first, leaf));
if (!bound) {
dout(7) << " opening bounding dirfrag " << leaf << " on " << *in << dendl;
- cache->open_remote_dirfrag(in, leaf, gather.new_sub());
+ mdcache->open_remote_dirfrag(in, leaf, gather.new_sub());
continue;
}
dout(7) << " all ready, noting auth and freezing import region" << dendl;
- if (!mds->mdcache->is_readonly() &&
+ if (!mdcache->is_readonly() &&
// for pinning scatter gather. loner has a higher chance to get wrlock
diri->filelock.can_wrlock(diri->get_loner()) &&
diri->nestlock.can_wrlock(diri->get_loner())) {
// note that i am an ambiguous auth for this subtree.
// specify bounds, since the exporter explicitly defines the region.
- cache->adjust_bounded_subtree_auth(dir, import_bounds,
+ mdcache->adjust_bounded_subtree_auth(dir, import_bounds,
pair<int,int>(oldauth, mds->get_nodeid()));
- cache->verify_subtree_bounds(dir, import_bounds);
+ mdcache->verify_subtree_bounds(dir, import_bounds);
// freeze.
dir->_freeze_tree();
// note new state
void Migrator::handle_export_dir(const cref_t<MExportDir> &m)
{
assert (g_conf()->mds_kill_import_at != 5);
- CDir *dir = cache->get_dirfrag(m->dirfrag);
+ CDir *dir = mdcache->get_dirfrag(m->dirfrag);
ceph_assert(dir);
mds_rank_t oldauth = mds_rank_t(m->get_source().num());
if (!dir->get_inode()->dirfragtree.is_leaf(dir->get_frag()))
dir->get_inode()->dirfragtree.force_to_leaf(g_ceph_context, dir->get_frag());
- cache->show_subtrees();
+ mdcache->show_subtrees();
C_MDS_ImportDirLoggedStart *onlogged = new C_MDS_ImportDirLoggedStart(this, dir, oldauth);
le->metablob.add_dir_context(dir);
// adjust auth (list us _first_)
- cache->adjust_subtree_auth(dir, mds->get_nodeid(), oldauth);
+ mdcache->adjust_subtree_auth(dir, mds->get_nodeid(), oldauth);
// new client sessions, open these after we journal
// include imported sessions in EImportStart
// include bounds in EImportStart
set<CDir*> import_bounds;
for (const auto &bound : m->bounds) {
- CDir *bd = cache->get_dirfrag(bound);
+ CDir *bd = mdcache->get_dirfrag(bound);
ceph_assert(bd);
le->metablob.add_dir(bd, false); // note that parent metadata is already in the event
import_bounds.insert(bd);
}
- cache->verify_subtree_bounds(dir, import_bounds);
+ mdcache->verify_subtree_bounds(dir, import_bounds);
// adjust popularity
mds->balancer->add_import(dir);
if (did.count(p->ino))
continue;
did.insert(p->ino);
- CInode *in = cache->get_inode(p->ino);
+ CInode *in = mdcache->get_inode(p->ino);
ceph_assert(in);
in->put_stickydirs();
}
stat.state = IMPORT_ABORTING;
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
// remove pins
import_remove_pins(dir, bounds);
// update auth, with possible subtree merge.
ceph_assert(dir->is_subtree_root());
if (mds->is_resolve())
- cache->trim_non_auth_subtree(dir);
+ mdcache->trim_non_auth_subtree(dir);
- cache->adjust_subtree_auth(dir, stat.peer);
+ mdcache->adjust_subtree_auth(dir, stat.peer);
auto fin = new C_MDC_QueueContexts(this);
if (!dir->get_inode()->is_auth() &&
}
}
- cache->touch_dentry_bottom(dn); // move dentry to tail of LRU
+ mdcache->touch_dentry_bottom(dn); // move dentry to tail of LRU
++num_dentries;
}
}
// log our failure
mds->mdlog->start_submit_entry(new EImportFinish(dir, false)); // log failure
- cache->trim(num_dentries); // try trimming dentries
+ mdcache->trim(num_dentries); // try trimming dentries
// notify bystanders; wait in aborting state
import_notify_abort(dir, bounds);
{
dout(7) << *dir << dendl;
ceph_assert(!dir->is_auth());
- cache->discard_delayed_expire(dir);
+ mdcache->discard_delayed_expire(dir);
dir->unfreeze_tree();
if (dir->is_subtree_root())
- cache->try_subtree_merge(dir);
+ mdcache->try_subtree_merge(dir);
import_reverse_final(dir);
}
import_state.erase(it);
// send pending import_maps?
- mds->mdcache->maybe_send_pending_resolves();
+ mdcache->maybe_send_pending_resolves();
if (mut) {
mds->locker->drop_locks(mut.get());
mut->cleanup();
}
- cache->show_subtrees();
+ mdcache->show_subtrees();
//audit(); // this fails, bc we munge up the subtree map during handle_import_map (resolve phase)
}
mds->send_message_mds(ack, from);
assert (g_conf()->mds_kill_import_at != 8);
- cache->show_subtrees();
+ mdcache->show_subtrees();
}
void Migrator::handle_export_finish(const cref_t<MExportDirFinish> &m)
{
- CDir *dir = cache->get_dirfrag(m->get_dirfrag());
+ CDir *dir = mdcache->get_dirfrag(m->get_dirfrag());
ceph_assert(dir);
dout(7) << *dir << (m->is_last() ? " last" : "") << dendl;
if (it->second.state == IMPORT_ACKING) {
ceph_assert(dir->is_auth());
- cache->adjust_subtree_auth(dir, mds->get_nodeid(), mds->get_nodeid());
+ mdcache->adjust_subtree_auth(dir, mds->get_nodeid(), mds->get_nodeid());
}
// log finish
ceph_assert(cap);
cap->merge(q->second, true);
cap->clear_importing();
- mds->mdcache->do_cap_import(session, in, cap, q->second.cap_id, q->second.seq,
+ mdcache->do_cap_import(session, in, cap, q->second.cap_id, q->second.seq,
q->second.mseq - 1, it->second.peer, CEPH_CAP_FLAG_AUTH);
}
p->second.clear();
// remove pins
set<CDir*> bounds;
- cache->get_subtree_bounds(dir, bounds);
+ mdcache->get_subtree_bounds(dir, bounds);
if (notify)
import_notify_finish(dir, bounds);
mds->mdlog->start_submit_entry(new EImportFinish(dir, true));
// process delayed expires
- cache->process_delayed_expire(dir);
+ mdcache->process_delayed_expire(dir);
// unfreeze tree, with possible subtree merge.
dir->unfreeze_tree();
- cache->try_subtree_merge(dir);
+ mdcache->try_subtree_merge(dir);
- cache->show_subtrees();
+ mdcache->show_subtrees();
//audit(); // this fails, bc we munge up the subtree map during handle_import_map (resolve phase)
if (mut) {
}
// send pending import_maps?
- mds->mdcache->maybe_send_pending_resolves();
+ mdcache->maybe_send_pending_resolves();
// did i just import mydir?
if (dir->ino() == MDS_INO_MDSDIR(mds->get_nodeid()))
- cache->populate_mydir();
+ mdcache->populate_mydir();
// is it empty?
if (dir->get_num_head_items() == 0 &&
decode(ino, blp);
decode(last, blp);
- in = cache->get_inode(ino, last);
+ in = mdcache->get_inode(ino, last);
if (!in) {
in = new CInode(mds->mdcache, true, 2, last);
added = true;
// add inode?
if (added) {
- cache->add_inode(in);
+ mdcache->add_inode(in);
dout(10) << "added " << *in << dendl;
} else {
dout(10) << " had " << *in << dendl;
if (peer >= 0) {
cap->merge(it.second, auth_cap);
- mds->mdcache->do_cap_import(session, in, cap, it.second.cap_id,
+ mdcache->do_cap_import(session, in, cap, it.second.cap_id,
it.second.seq, it.second.mseq - 1, peer,
auth_cap ? CEPH_CAP_FLAG_AUTH : CEPH_CAP_FLAG_RELEASE);
}
dirfrag_t df;
decode(df, blp);
- CInode *diri = cache->get_inode(df.ino);
+ CInode *diri = mdcache->get_inode(df.ino);
ceph_assert(diri);
CDir *dir = diri->get_or_open_dirfrag(mds->mdcache, df.frag);
ceph_assert(dir);
return;
}
- CDir *dir = cache->get_dirfrag(m->get_dirfrag());
+ CDir *dir = mdcache->get_dirfrag(m->get_dirfrag());
mds_rank_t from = mds_rank_t(m->get_source().num());
mds_authority_t old_auth = m->get_old_auth();
<< " on " << *dir << dendl;
// adjust auth
set<CDir*> have;
- cache->map_dirfrag_set(m->get_bounds(), have);
- cache->adjust_bounded_subtree_auth(dir, have, new_auth);
+ mdcache->map_dirfrag_set(m->get_bounds(), have);
+ mdcache->adjust_bounded_subtree_auth(dir, have, new_auth);
// induce a merge?
- cache->try_subtree_merge(dir);
+ mdcache->try_subtree_merge(dir);
}
// send ack
void Migrator::handle_export_caps_ack(const cref_t<MExportCapsAck> &ack)
{
mds_rank_t from = ack->get_source().num();
- CInode *in = cache->get_inode(ack->ino);
+ CInode *in = mdcache->get_inode(ack->ino);
if (in) {
ceph_assert(!in->is_auth());
void Migrator::handle_gather_caps(const cref_t<MGatherCaps> &m)
{
- CInode *in = cache->get_inode(m->ino);
+ CInode *in = mdcache->get_inode(m->ino);
if (!in)
return;
void Migrator::handle_export_caps(const cref_t<MExportCaps> &ex)
{
dout(10) << *ex << " from " << ex->get_source() << dendl;
- CInode *in = cache->get_inode(ex->ino);
+ CInode *in = mdcache->get_inode(ex->ino);
ceph_assert(in);
ceph_assert(in->is_auth());
in->auth_unpin(this);
}
-Migrator::Migrator(MDSRank *m, MDCache *c) : mds(m), cache(c) {
+Migrator::Migrator(MDSRank *m, MDCache *c) : mds(m), mdcache(c) {
max_export_size = g_conf().get_val<Option::size_t>("mds_max_export_size");
inject_session_race = g_conf().get_val<bool>("mds_inject_migrator_session_race");
}