aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-04-02 14:34:06 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-05-29 23:28:33 -0400
commitb0b0382bb4904965a9e9fca77ad87514dfda0d1c (patch)
treedc46873fa74e0d194e4a2571b16f0767e1919ae8 /fs/fuse
parent6d42e7e9f6d86ed4dfacde75a6cf515068f9749c (diff)
->encode_fh() API change
pass inode + parent's inode or NULL instead of dentry + bool saying whether we want the parent or not. NOTE: that needs ceph fix folded in. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/inode.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 56f6dcf30768..42678a33b7bb 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -627,12 +627,10 @@ static struct dentry *fuse_get_dentry(struct super_block *sb,
627 return ERR_PTR(err); 627 return ERR_PTR(err);
628} 628}
629 629
630static int fuse_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, 630static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len,
631 int connectable) 631 struct inode *parent)
632{ 632{
633 struct inode *inode = dentry->d_inode; 633 int len = parent ? 6 : 3;
634 bool encode_parent = connectable && !S_ISDIR(inode->i_mode);
635 int len = encode_parent ? 6 : 3;
636 u64 nodeid; 634 u64 nodeid;
637 u32 generation; 635 u32 generation;
638 636
@@ -648,14 +646,9 @@ static int fuse_encode_fh(struct dentry *dentry, u32 *fh, int *max_len,
648 fh[1] = (u32)(nodeid & 0xffffffff); 646 fh[1] = (u32)(nodeid & 0xffffffff);
649 fh[2] = generation; 647 fh[2] = generation;
650 648
651 if (encode_parent) { 649 if (parent) {
652 struct inode *parent;
653
654 spin_lock(&dentry->d_lock);
655 parent = dentry->d_parent->d_inode;
656 nodeid = get_fuse_inode(parent)->nodeid; 650 nodeid = get_fuse_inode(parent)->nodeid;
657 generation = parent->i_generation; 651 generation = parent->i_generation;
658 spin_unlock(&dentry->d_lock);
659 652
660 fh[3] = (u32)(nodeid >> 32); 653 fh[3] = (u32)(nodeid >> 32);
661 fh[4] = (u32)(nodeid & 0xffffffff); 654 fh[4] = (u32)(nodeid & 0xffffffff);
@@ -663,7 +656,7 @@ static int fuse_encode_fh(struct dentry *dentry, u32 *fh, int *max_len,
663 } 656 }
664 657
665 *max_len = len; 658 *max_len = len;
666 return encode_parent ? 0x82 : 0x81; 659 return parent ? 0x82 : 0x81;
667} 660}
668 661
669static struct dentry *fuse_fh_to_dentry(struct super_block *sb, 662static struct dentry *fuse_fh_to_dentry(struct super_block *sb,