in->dirstat = st->dirstat;
in->rstat = st->rstat;
+ if (in->is_dir()) {
+ in->dir_layout = st->dir_layout;
+ dout(20) << " dir hash is " << (int)in->dir_layout.dl_dir_hash << dendl;
+ }
+
in->layout = st->layout;
in->ctime = st->ctime;
in->max_size = st->max_size; // right?
return NULL;
}
+ Connection *con = request->reply->get_connection();
+ int features = con->get_features();
+ dout(10) << " features 0x" << hex << features << dec << dendl;
+
// snap trace
if (reply->snapbl.length())
update_snap_trace(reply->snapbl);
InodeStat ist;
if (reply->head.is_dentry) {
- dirst.decode(p);
+ dirst.decode(p, features);
dst.decode(p);
::decode(dname, p);
::decode(dlease, p);
Inode *in = 0;
if (reply->head.is_target) {
- ist.decode(p);
+ ist.decode(p, features);
in = add_update_inode(&ist, from, mds);
}
for (unsigned i=0; i<numdn; i++) {
::decode(dname, p);
::decode(dlease, p);
- InodeStat ist(p);
+ InodeStat ist(p, features);
Inode *in = add_update_inode(&ist, from, mds);
Dentry *dn = insert_dentry_inode(dir, dname, &dlease, in, from, mds, false);
if (req->inode) {
in = req->inode;
+ if (req->path.depth()) {
+ hash = ceph_str_hash(in->dir_layout.dl_dir_hash,
+ req->path[0].data(),
+ req->path[0].length());
+ dout(20) << " dir hash is " << (int)in->dir_layout.dl_dir_hash << " on " << req->path[0]
+ << " => " << hash << dendl;
+ is_hash = true;
+
+ }
} else if (req->dentry) {
if (req->dentry->inode) {
in = req->dentry->inode;
} else {
in = req->dentry->dir->parent_inode;
- hash = ceph_str_hash_linux(req->dentry->name.data(),
- req->dentry->name.length());
+ hash = ceph_str_hash(in->dir_layout.dl_dir_hash,
+ req->dentry->name.data(),
+ req->dentry->name.length());
+ dout(20) << " dir hash is " << (int)in->dir_layout.dl_dir_hash << " on " << req->dentry->name
+ << " => " << hash << dendl;
is_hash = true;
}
}
struct ceph_timespec rctime;
struct ceph_frag_tree_head fragtree; /* (must be at end of struct) */
} __attribute__ ((packed));
-/* followed by frag array, then symlink string, then xattr blob */
+/* followed by frag array, symlink string, dir layout, xattr blob */
/* reply_lease follows dname, and reply_inode */
struct ceph_mds_reply_lease {
version_t xattr_version;
bufferlist xattrbl;
+
+ ceph_dir_layout dir_layout;
+
//map<string, bufferptr> xattrs;
public:
InodeStat() {}
- InodeStat(bufferlist::iterator& p) {
- decode(p);
+ InodeStat(bufferlist::iterator& p, int features) {
+ decode(p, features);
}
- void decode(bufferlist::iterator &p) {
+ void decode(bufferlist::iterator &p, int features) {
struct ceph_mds_reply_inode e;
::decode(e, p);
vino.ino = inodeno_t(e.ino);
}
::decode(symlink, p);
+ if (features & CEPH_FEATURE_DIRLAYOUTHASH)
+ ::decode(dir_layout, p);
+ else
+ memset(&dir_layout, 0, sizeof(dir_layout));
+
xattr_version = e.xattr_version;
::decode(xattrbl, p);
}