}
}
dn->cap_shared_gen = dn->dir->parent_inode->shared_gen;
+ if (dlease->mask & CEPH_LEASE_PRIMARY_LINK)
+ dn->mark_primary();
}
<< " wants " << ccap_string(in->caps_wanted())
<< dendl;
filepath path;
- in->make_long_path(path);
+ in->make_short_path(path);
ldout(cct, 10) << " path " << path << dendl;
bufferlist flockbl;
inode.reset();
dir->num_null_dentries++;
}
+ void mark_primary() {
+ if (inode && inode->dentries.front() != this)
+ inode->dentries.push_front(&inode_xlist_link);
+ }
void detach(void) {
ceph_assert(!inode);
auto p = dir->dentries.find(name);
dn->dir->parent_inode->make_long_path(p);
p.push_dentry(dn->name);
} else if (snapdir_parent) {
- snapdir_parent->make_nosnap_relative_path(p);
- string empty;
- p.push_dentry(empty);
+ make_nosnap_relative_path(p);
+ } else
+ p = filepath(ino);
+}
+
+void Inode::make_short_path(filepath& p)
+{
+ if (!dentries.empty()) {
+ Dentry *dn = get_first_parent();
+ ceph_assert(dn->dir && dn->dir->parent_inode);
+ p = filepath(dn->name, dn->dir->parent_inode->ino);
+ } else if (snapdir_parent) {
+ make_nosnap_relative_path(p);
} else
p = filepath(ino);
}
}
void make_long_path(filepath& p);
+ void make_short_path(filepath& p);
void make_nosnap_relative_path(filepath& p);
void get();