aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/export.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-09-05 16:43:20 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:07 -0400
commit50ec891cc54fb865c4c40c45845e60123e0e66ca (patch)
treef428fec2622044cd6b0a3adc90f0d7be6b62b6b9 /fs/btrfs/export.c
parent91c0827de247303c6dfc40a8ec9d8305e1d07986 (diff)
Btrfs: cleanup d_obtain_alias useage
d_obtain_alias is intended as a tailcall that can pass in errors encoded in the inode pointer if needed, so use it that way instead of duplicating the error handling. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/export.c')
-rw-r--r--fs/btrfs/export.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index 292b0b24c302..2b357a6d2407 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -68,7 +68,6 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
68{ 68{
69 struct btrfs_root *root; 69 struct btrfs_root *root;
70 struct inode *inode; 70 struct inode *inode;
71 struct dentry *result;
72 struct btrfs_key key; 71 struct btrfs_key key;
73 72
74 key.objectid = root_objectid; 73 key.objectid = root_objectid;
@@ -92,11 +91,7 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
92 return ERR_PTR(-ESTALE); 91 return ERR_PTR(-ESTALE);
93 } 92 }
94 93
95 result = d_obtain_alias(inode); 94 return d_obtain_alias(inode);
96 if (!result)
97 return ERR_PTR(-ENOMEM);
98
99 return result;
100} 95}
101 96
102static struct dentry *btrfs_fh_to_parent(struct super_block *sb, struct fid *fh, 97static struct dentry *btrfs_fh_to_parent(struct super_block *sb, struct fid *fh,
@@ -148,8 +143,6 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
148static struct dentry *btrfs_get_parent(struct dentry *child) 143static struct dentry *btrfs_get_parent(struct dentry *child)
149{ 144{
150 struct inode *dir = child->d_inode; 145 struct inode *dir = child->d_inode;
151 struct inode *inode;
152 struct dentry *parent;
153 struct btrfs_root *root = BTRFS_I(dir)->root; 146 struct btrfs_root *root = BTRFS_I(dir)->root;
154 struct btrfs_key key; 147 struct btrfs_key key;
155 struct btrfs_path *path; 148 struct btrfs_path *path;
@@ -203,13 +196,7 @@ static struct dentry *btrfs_get_parent(struct dentry *child)
203 btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY); 196 btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
204 key.offset = 0; 197 key.offset = 0;
205 198
206 inode = btrfs_iget(root->fs_info->sb, &key, root, NULL); 199 return d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL));
207
208 parent = d_obtain_alias(inode);
209 if (!parent)
210 parent = ERR_PTR(-ENOMEM);
211
212 return parent;
213} 200}
214 201
215const struct export_operations btrfs_export_ops = { 202const struct export_operations btrfs_export_ops = {