Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128912
b: refs/heads/master
c: 87acb4e
h: refs/heads/master
v: v3
  • Loading branch information
David Woodhouse authored and Chris Mason committed Sep 25, 2008
1 parent 7d03e93 commit 15f0b7f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 32d48fa1af1fe066a6a4798e6f5a50ac6a3ce4a3
refs/heads/master: 87acb4ef9b2991e1c453b78d71bce2ef994ef1ff
26 changes: 11 additions & 15 deletions trunk/fs/btrfs/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ static struct dentry *btrfs_get_parent(struct dentry *child)
struct btrfs_key key;
struct btrfs_path *path;
struct extent_buffer *leaf;
u32 nritems;
int slot;
u64 objectid;
int ret;
Expand All @@ -156,27 +155,24 @@ static struct dentry *btrfs_get_parent(struct dentry *child)

key.objectid = dir->i_ino;
btrfs_set_key_type(&key, BTRFS_INODE_REF_KEY);
key.offset = 0;
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
BUG_ON(ret == 0);
ret = 0;
key.offset = (u64)-1;

ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
leaf = path->nodes[0];
slot = path->slots[0];
nritems = btrfs_header_nritems(leaf);
if (slot >= nritems) {
ret = btrfs_next_leaf(root, path);
if (ret) {
btrfs_free_path(path);
goto out;
}
leaf = path->nodes[0];
slot = path->slots[0];
if (ret < 0 || slot == 0) {
btrfs_free_path(path);
goto out;
}
/* btrfs_search_slot() returns the slot where we'd want to insert
an INODE_REF_KEY for parent inode #0xFFFFFFFFFFFFFFFF. The _real_
one, telling us what the parent inode _actually_ is, will be in
the slot _before_ the one that btrfs_search_slot() returns. */
slot--;

btrfs_item_key_to_cpu(leaf, &key, slot);
btrfs_free_path(path);

btrfs_item_key_to_cpu(leaf, &key, slot);
if (key.objectid != dir->i_ino || key.type != BTRFS_INODE_REF_KEY)
goto out;

Expand Down

0 comments on commit 15f0b7f

Please sign in to comment.