}
}
-/**
- * If a remote dentry refers to an inode whose primary
- * dentry is a stray, then evaluate the inode for purging if
- * we have the auth copy, or migrate the stray to use if we
- * do not.
- */
-void MDCache::eval_remote(CDentry *remote_dn)
-{
- assert(remote_dn);
- dout(10) << __func__ << " " << *remote_dn << dendl;
-
- CDentry::linkage_t *dnl = remote_dn->get_projected_linkage();
- assert(dnl->is_remote());
- CInode *in = dnl->get_inode();
-
- if (!in) {
- dout(20) << __func__ << ": no inode, cannot evaluate" << dendl;
- return;
- }
-
- if (remote_dn->last != CEPH_NOSNAP) {
- dout(20) << __func__ << ": snap dentry, cannot evaluate" << dendl;
- return;
- }
-
- // refers to stray?
- CDentry *primary_dn = in->get_projected_parent_dn();
- assert(primary_dn != NULL);
- if (primary_dn->get_dir()->get_inode()->is_stray()) {
- stray_manager.eval_remote_stray(primary_dn, remote_dn);
- } else {
- dout(20) << __func__ << ": inode's primary dn not stray" << dendl;
- }
-}
-
void MDCache::fetch_backtrace(inodeno_t ino, int64_t pool, bufferlist& bl, Context *fin)
{
object_t oid = CInode::get_object_name(ino, frag_t(), "");
stray_manager.notify_stray_created();
}
+ void eval_remote(CDentry *dn)
+ {
+ stray_manager.eval_remote(dn);
+ }
+
// -- client caps --
uint64_t last_cap_id;
// -- stray --
public:
- void eval_remote(CDentry *dn);
void fetch_backtrace(inodeno_t ino, int64_t pool, bufferlist& bl, Context *fin);
uint64_t get_num_strays() const { return stray_manager.get_num_strays(); }
* if we can do anything with them if we happen to have them in
* cache.
*/
- eval_remote_stray(dn, NULL);
+ _eval_stray_remote(dn, NULL);
return false;
}
}
return ret;
}
-void StrayManager::eval_remote_stray(CDentry *stray_dn, CDentry *remote_dn)
+void StrayManager::eval_remote(CDentry *remote_dn)
{
+ dout(10) << __func__ << " " << *remote_dn << dendl;
+
+ CDentry::linkage_t *dnl = remote_dn->get_projected_linkage();
+ assert(dnl->is_remote());
+ CInode *in = dnl->get_inode();
+
+ if (!in) {
+ dout(20) << __func__ << ": no inode, cannot evaluate" << dendl;
+ return;
+ }
+
+ if (remote_dn->last != CEPH_NOSNAP) {
+ dout(20) << __func__ << ": snap dentry, cannot evaluate" << dendl;
+ return;
+ }
+
+ // refers to stray?
+ CDentry *primary_dn = in->get_projected_parent_dn();
+ assert(primary_dn != NULL);
+ if (primary_dn->get_dir()->get_inode()->is_stray()) {
+ _eval_stray_remote(primary_dn, remote_dn);
+ } else {
+ dout(20) << __func__ << ": inode's primary dn not stray" << dendl;
+ }
+}
+
+void StrayManager::_eval_stray_remote(CDentry *stray_dn, CDentry *remote_dn)
+{
+ dout(20) << __func__ << " " << *stray_dn << dendl;
assert(stray_dn != NULL);
assert(stray_dn->get_dir()->get_inode()->is_stray());
CDentry::linkage_t *stray_dnl = stray_dn->get_projected_linkage();
*/
bool _eval_stray(CDentry *dn, bool delay=false);
+ void _eval_stray_remote(CDentry *stray_dn, CDentry *remote_dn);
+
// My public interface is for consumption by MDCache
public:
explicit StrayManager(MDSRank *mds, PurgeQueue &purge_queue_);
void advance_delayed();
/**
- * When a metadata op touches a remote dentry that points to
- * a stray, call in here to evaluate it for migration (move
- * a stray residing on another MDS to this MDS) or reintegration
- * (move a stray dentry's inode into a non-stray hardlink dentry and
- * clean up the stray).
+ * Remote dentry potentially points to a stray. When it is touched,
+ * call in here to evaluate it for migration (move a stray residing
+ * on another MDS to this MDS) or reintegration (move a stray dentry's
+ * inode into a non-stray hardlink dentry and clean up the stray).
*
* @param stray_dn a stray dentry whose inode has been referenced
* by a remote dentry
* as a hint for which remote to reintegrate into
* if there are multiple remotes.
*/
- void eval_remote_stray(CDentry *stray_dn, CDentry *remote_dn=NULL);
+ void eval_remote(CDentry *remote_dn);
/**
* Given a dentry within one of my stray directories,