aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
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/btrfs
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/btrfs')
-rw-r--r--fs/btrfs/export.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index e887ee62b6d..614f34a899c 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -13,15 +13,14 @@
13 parent_root_objectid) / 4) 13 parent_root_objectid) / 4)
14#define BTRFS_FID_SIZE_CONNECTABLE_ROOT (sizeof(struct btrfs_fid) / 4) 14#define BTRFS_FID_SIZE_CONNECTABLE_ROOT (sizeof(struct btrfs_fid) / 4)
15 15
16static int btrfs_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, 16static int btrfs_encode_fh(struct inode *inode, u32 *fh, int *max_len,
17 int connectable) 17 struct inode *parent)
18{ 18{
19 struct btrfs_fid *fid = (struct btrfs_fid *)fh; 19 struct btrfs_fid *fid = (struct btrfs_fid *)fh;
20 struct inode *inode = dentry->d_inode;
21 int len = *max_len; 20 int len = *max_len;
22 int type; 21 int type;
23 22
24 if (connectable && (len < BTRFS_FID_SIZE_CONNECTABLE)) { 23 if (parent && (len < BTRFS_FID_SIZE_CONNECTABLE)) {
25 *max_len = BTRFS_FID_SIZE_CONNECTABLE; 24 *max_len = BTRFS_FID_SIZE_CONNECTABLE;
26 return 255; 25 return 255;
27 } else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) { 26 } else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) {
@@ -36,19 +35,13 @@ static int btrfs_encode_fh(struct dentry *dentry, u32 *fh, int *max_len,
36 fid->root_objectid = BTRFS_I(inode)->root->objectid; 35 fid->root_objectid = BTRFS_I(inode)->root->objectid;
37 fid->gen = inode->i_generation; 36 fid->gen = inode->i_generation;
38 37
39 if (connectable && !S_ISDIR(inode->i_mode)) { 38 if (parent) {
40 struct inode *parent;
41 u64 parent_root_id; 39 u64 parent_root_id;
42 40
43 spin_lock(&dentry->d_lock);
44
45 parent = dentry->d_parent->d_inode;
46 fid->parent_objectid = BTRFS_I(parent)->location.objectid; 41 fid->parent_objectid = BTRFS_I(parent)->location.objectid;
47 fid->parent_gen = parent->i_generation; 42 fid->parent_gen = parent->i_generation;
48 parent_root_id = BTRFS_I(parent)->root->objectid; 43 parent_root_id = BTRFS_I(parent)->root->objectid;
49 44
50 spin_unlock(&dentry->d_lock);
51
52 if (parent_root_id != fid->root_objectid) { 45 if (parent_root_id != fid->root_objectid) {
53 fid->parent_root_objectid = parent_root_id; 46 fid->parent_root_objectid = parent_root_id;
54 len = BTRFS_FID_SIZE_CONNECTABLE_ROOT; 47 len = BTRFS_FID_SIZE_CONNECTABLE_ROOT;