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 b4ffad859adb..1b8dc33778f9 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c | |||
@@ -32,7 +32,7 @@ static int btrfs_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, | |||
32 | len = BTRFS_FID_SIZE_NON_CONNECTABLE; | 32 | len = BTRFS_FID_SIZE_NON_CONNECTABLE; |
33 | type = FILEID_BTRFS_WITHOUT_PARENT; | 33 | type = FILEID_BTRFS_WITHOUT_PARENT; |
34 | 34 | ||
35 | fid->objectid = inode->i_ino; | 35 | fid->objectid = btrfs_ino(inode); |
36 | fid->root_objectid = BTRFS_I(inode)->root->objectid; | 36 | fid->root_objectid = BTRFS_I(inode)->root->objectid; |
37 | fid->gen = inode->i_generation; | 37 | fid->gen = inode->i_generation; |
38 | 38 | ||
@@ -178,13 +178,13 @@ static struct dentry *btrfs_get_parent(struct dentry *child) | |||
178 | if (!path) | 178 | if (!path) |
179 | return ERR_PTR(-ENOMEM); | 179 | return ERR_PTR(-ENOMEM); |
180 | 180 | ||
181 | if (dir->i_ino == BTRFS_FIRST_FREE_OBJECTID) { | 181 | if (btrfs_ino(dir) == BTRFS_FIRST_FREE_OBJECTID) { |
182 | key.objectid = root->root_key.objectid; | 182 | key.objectid = root->root_key.objectid; |
183 | key.type = BTRFS_ROOT_BACKREF_KEY; | 183 | key.type = BTRFS_ROOT_BACKREF_KEY; |
184 | key.offset = (u64)-1; | 184 | key.offset = (u64)-1; |
185 | root = root->fs_info->tree_root; | 185 | root = root->fs_info->tree_root; |
186 | } else { | 186 | } else { |
187 | key.objectid = dir->i_ino; | 187 | key.objectid = btrfs_ino(dir); |
188 | key.type = BTRFS_INODE_REF_KEY; | 188 | key.type = BTRFS_INODE_REF_KEY; |
189 | key.offset = (u64)-1; | 189 | key.offset = (u64)-1; |
190 | } | 190 | } |
@@ -244,6 +244,7 @@ static int btrfs_get_name(struct dentry *parent, char *name, | |||
244 | struct btrfs_key key; | 244 | struct btrfs_key key; |
245 | int name_len; | 245 | int name_len; |
246 | int ret; | 246 | int ret; |
247 | u64 ino; | ||
247 | 248 | ||
248 | if (!dir || !inode) | 249 | if (!dir || !inode) |
249 | return -EINVAL; | 250 | return -EINVAL; |
@@ -251,19 +252,21 @@ static int btrfs_get_name(struct dentry *parent, char *name, | |||
251 | if (!S_ISDIR(dir->i_mode)) | 252 | if (!S_ISDIR(dir->i_mode)) |
252 | return -EINVAL; | 253 | return -EINVAL; |
253 | 254 | ||
255 | ino = btrfs_ino(inode); | ||
256 | |||
254 | path = btrfs_alloc_path(); | 257 | path = btrfs_alloc_path(); |
255 | if (!path) | 258 | if (!path) |
256 | return -ENOMEM; | 259 | return -ENOMEM; |
257 | path->leave_spinning = 1; | 260 | path->leave_spinning = 1; |
258 | 261 | ||
259 | if (inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) { | 262 | if (ino == BTRFS_FIRST_FREE_OBJECTID) { |
260 | key.objectid = BTRFS_I(inode)->root->root_key.objectid; | 263 | key.objectid = BTRFS_I(inode)->root->root_key.objectid; |
261 | key.type = BTRFS_ROOT_BACKREF_KEY; | 264 | key.type = BTRFS_ROOT_BACKREF_KEY; |
262 | key.offset = (u64)-1; | 265 | key.offset = (u64)-1; |
263 | root = root->fs_info->tree_root; | 266 | root = root->fs_info->tree_root; |
264 | } else { | 267 | } else { |
265 | key.objectid = inode->i_ino; | 268 | key.objectid = ino; |
266 | key.offset = dir->i_ino; | 269 | key.offset = btrfs_ino(dir); |
267 | key.type = BTRFS_INODE_REF_KEY; | 270 | key.type = BTRFS_INODE_REF_KEY; |
268 | } | 271 | } |
269 | 272 | ||
@@ -272,7 +275,7 @@ static int btrfs_get_name(struct dentry *parent, char *name, | |||
272 | btrfs_free_path(path); | 275 | btrfs_free_path(path); |
273 | return ret; | 276 | return ret; |
274 | } else if (ret > 0) { | 277 | } else if (ret > 0) { |
275 | if (inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) { | 278 | if (ino == BTRFS_FIRST_FREE_OBJECTID) { |
276 | path->slots[0]--; | 279 | path->slots[0]--; |
277 | } else { | 280 | } else { |
278 | btrfs_free_path(path); | 281 | btrfs_free_path(path); |
@@ -281,11 +284,11 @@ static int btrfs_get_name(struct dentry *parent, char *name, | |||
281 | } | 284 | } |
282 | leaf = path->nodes[0]; | 285 | leaf = path->nodes[0]; |
283 | 286 | ||
284 | if (inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) { | 287 | if (ino == BTRFS_FIRST_FREE_OBJECTID) { |
285 | rref = btrfs_item_ptr(leaf, path->slots[0], | 288 | rref = btrfs_item_ptr(leaf, path->slots[0], |
286 | struct btrfs_root_ref); | 289 | struct btrfs_root_ref); |
287 | name_ptr = (unsigned long)(rref + 1); | 290 | name_ptr = (unsigned long)(rref + 1); |
288 | name_len = btrfs_root_ref_name_len(leaf, rref); | 291 | name_len = btrfs_root_ref_name_len(leaf, rref); |
289 | } else { | 292 | } else { |
290 | iref = btrfs_item_ptr(leaf, path->slots[0], | 293 | iref = btrfs_item_ptr(leaf, path->slots[0], |
291 | struct btrfs_inode_ref); | 294 | struct btrfs_inode_ref); |