Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 210048
b: refs/heads/master
c: eb6bb1c
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed Aug 22, 2010
1 parent 6461ab6 commit 47b7bca
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ed326044489ed89c740c50a3df5dffc9c3b20b96
refs/heads/master: eb6bb1c5bdc6e455a9d16cb845cc65afc9b0a617
26 changes: 24 additions & 2 deletions trunk/fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,13 @@ static void __unregister_request(struct ceph_mds_client *mdsc,
*
* Called under mdsc->mutex.
*/
struct dentry *get_nonsnap_parent(struct dentry *dentry)
{
while (!IS_ROOT(dentry) && ceph_snap(dentry->d_inode) != CEPH_NOSNAP)
dentry = dentry->d_parent;
return dentry;
}

static int __choose_mds(struct ceph_mds_client *mdsc,
struct ceph_mds_request *req)
{
Expand Down Expand Up @@ -590,14 +597,29 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
if (req->r_inode) {
inode = req->r_inode;
} else if (req->r_dentry) {
if (req->r_dentry->d_inode) {
struct inode *dir = req->r_dentry->d_parent->d_inode;

if (dir->i_sb != mdsc->client->sb) {
/* not this fs! */
inode = req->r_dentry->d_inode;
} else if (ceph_snap(dir) != CEPH_NOSNAP) {
/* direct snapped/virtual snapdir requests
* based on parent dir inode */
struct dentry *dn =
get_nonsnap_parent(req->r_dentry->d_parent);
inode = dn->d_inode;
dout("__choose_mds using nonsnap parent %p\n", inode);
} else if (req->r_dentry->d_inode) {
/* dentry target */
inode = req->r_dentry->d_inode;
} else {
inode = req->r_dentry->d_parent->d_inode;
/* dir + name */
inode = dir;
hash = req->r_dentry->d_name.hash;
is_hash = true;
}
}

dout("__choose_mds %p is_hash=%d (%d) mode %d\n", inode, (int)is_hash,
(int)hash, mode);
if (!inode)
Expand Down

0 comments on commit 47b7bca

Please sign in to comment.