diff options
Diffstat (limited to 'fs/btrfs/export.c')
-rw-r--r-- | fs/btrfs/export.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index ff27d7a477b2..7fa283e7d306 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c | |||
@@ -28,7 +28,7 @@ static int btrfs_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, | |||
28 | len = BTRFS_FID_SIZE_NON_CONNECTABLE; | 28 | len = BTRFS_FID_SIZE_NON_CONNECTABLE; |
29 | type = FILEID_BTRFS_WITHOUT_PARENT; | 29 | type = FILEID_BTRFS_WITHOUT_PARENT; |
30 | 30 | ||
31 | fid->objectid = inode->i_ino; | 31 | fid->objectid = btrfs_ino(inode); |
32 | fid->root_objectid = BTRFS_I(inode)->root->objectid; | 32 | fid->root_objectid = BTRFS_I(inode)->root->objectid; |
33 | fid->gen = inode->i_generation; | 33 | fid->gen = inode->i_generation; |
34 | 34 | ||
@@ -174,13 +174,13 @@ static struct dentry *btrfs_get_parent(struct dentry *child) | |||
174 | if (!path) | 174 | if (!path) |
175 | return ERR_PTR(-ENOMEM); | 175 | return ERR_PTR(-ENOMEM); |
176 | 176 | ||
177 | if (dir->i_ino == BTRFS_FIRST_FREE_OBJECTID) { | 177 | if (btrfs_ino(dir) == BTRFS_FIRST_FREE_OBJECTID) { |
178 | key.objectid = root->root_key.objectid; | 178 | key.objectid = root->root_key.objectid; |
179 | key.type = BTRFS_ROOT_BACKREF_KEY; | 179 | key.type = BTRFS_ROOT_BACKREF_KEY; |
180 | key.offset = (u64)-1; | 180 | key.offset = (u64)-1; |
181 | root = root->fs_info->tree_root; | 181 | root = root->fs_info->tree_root; |
182 | } else { | 182 | } else { |
183 | key.objectid = dir->i_ino; | 183 | key.objectid = btrfs_ino(dir); |
184 | key.type = BTRFS_INODE_REF_KEY; | 184 | key.type = BTRFS_INODE_REF_KEY; |
185 | key.offset = (u64)-1; | 185 | key.offset = (u64)-1; |
186 | } | 186 | } |
@@ -240,6 +240,7 @@ static int btrfs_get_name(struct dentry *parent, char *name, | |||
240 | struct btrfs_key key; | 240 | struct btrfs_key key; |
241 | int name_len; | 241 | int name_len; |
242 | int ret; | 242 | int ret; |
243 | u64 ino; | ||
243 | 244 | ||
244 | if (!dir || !inode) | 245 | if (!dir || !inode) |
245 | return -EINVAL; | 246 | return -EINVAL; |
@@ -247,19 +248,21 @@ static int btrfs_get_name(struct dentry *parent, char *name, | |||
247 | if (!S_ISDIR(dir->i_mode)) | 248 | if (!S_ISDIR(dir->i_mode)) |
248 | return -EINVAL; | 249 | return -EINVAL; |
249 | 250 | ||
251 | ino = btrfs_ino(inode); | ||
252 | |||
250 | path = btrfs_alloc_path(); | 253 | path = btrfs_alloc_path(); |
251 | if (!path) | 254 | if (!path) |
252 | return -ENOMEM; | 255 | return -ENOMEM; |
253 | path->leave_spinning = 1; | 256 | path->leave_spinning = 1; |
254 | 257 | ||
255 | if (inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) { | 258 | if (ino == BTRFS_FIRST_FREE_OBJECTID) { |
256 | key.objectid = BTRFS_I(inode)->root->root_key.objectid; | 259 | key.objectid = BTRFS_I(inode)->root->root_key.objectid; |
257 | key.type = BTRFS_ROOT_BACKREF_KEY; | 260 | key.type = BTRFS_ROOT_BACKREF_KEY; |
258 | key.offset = (u64)-1; | 261 | key.offset = (u64)-1; |
259 | root = root->fs_info->tree_root; | 262 | root = root->fs_info->tree_root; |
260 | } else { | 263 | } else { |
261 | key.objectid = inode->i_ino; | 264 | key.objectid = ino; |
262 | key.offset = dir->i_ino; | 265 | key.offset = btrfs_ino(dir); |
263 | key.type = BTRFS_INODE_REF_KEY; | 266 | key.type = BTRFS_INODE_REF_KEY; |
264 | } | 267 | } |
265 | 268 | ||
@@ -268,7 +271,7 @@ static int btrfs_get_name(struct dentry *parent, char *name, | |||
268 | btrfs_free_path(path); | 271 | btrfs_free_path(path); |
269 | return ret; | 272 | return ret; |
270 | } else if (ret > 0) { | 273 | } else if (ret > 0) { |
271 | if (inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) { | 274 | if (ino == BTRFS_FIRST_FREE_OBJECTID) { |
272 | path->slots[0]--; | 275 | path->slots[0]--; |
273 | } else { | 276 | } else { |
274 | btrfs_free_path(path); | 277 | btrfs_free_path(path); |
@@ -277,11 +280,11 @@ static int btrfs_get_name(struct dentry *parent, char *name, | |||
277 | } | 280 | } |
278 | leaf = path->nodes[0]; | 281 | leaf = path->nodes[0]; |
279 | 282 | ||
280 | if (inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) { | 283 | if (ino == BTRFS_FIRST_FREE_OBJECTID) { |
281 | rref = btrfs_item_ptr(leaf, path->slots[0], | 284 | rref = btrfs_item_ptr(leaf, path->slots[0], |
282 | struct btrfs_root_ref); | 285 | struct btrfs_root_ref); |
283 | name_ptr = (unsigned long)(rref + 1); | 286 | name_ptr = (unsigned long)(rref + 1); |
284 | name_len = btrfs_root_ref_name_len(leaf, rref); | 287 | name_len = btrfs_root_ref_name_len(leaf, rref); |
285 | } else { | 288 | } else { |
286 | iref = btrfs_item_ptr(leaf, path->slots[0], | 289 | iref = btrfs_item_ptr(leaf, path->slots[0], |
287 | struct btrfs_inode_ref); | 290 | struct btrfs_inode_ref); |