Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128855
b: refs/heads/master
c: 445dceb
h: refs/heads/master
i:
  128853: 43c9175
  128851: d5afe99
  128847: a391b04
v: v3
  • Loading branch information
Yan authored and Chris Mason committed Sep 25, 2008
1 parent 561cba8 commit 6226783
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 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: 974e35a82d022434efa50fe5f805ae14c542ba8c
refs/heads/master: 445dceb78f3445b9bcade90e93ca35cae6120172
22 changes: 9 additions & 13 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1752,21 +1752,18 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
if (namelen == 2 && strcmp(name, "..") == 0) {
struct btrfs_key key;
struct extent_buffer *leaf;
u32 nritems;
int slot;

key.objectid = dir->i_ino;
key.offset = (u64)-1;
btrfs_set_key_type(&key, BTRFS_INODE_REF_KEY);
key.offset = 0;
if (ret < 0 || path->slots[0] == 0)
goto out_err;
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
BUG_ON(ret == 0);
ret = 0;

leaf = path->nodes[0];
slot = path->slots[0];
nritems = btrfs_header_nritems(leaf);
if (slot >= nritems)
goto out_err;
slot = path->slots[0] - 1;

btrfs_item_key_to_cpu(leaf, &key, slot);
if (key.objectid != dir->i_ino ||
Expand Down Expand Up @@ -1980,16 +1977,15 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
/* special case for .., just use the back ref */
if (filp->f_pos == 1) {
btrfs_set_key_type(&key, BTRFS_INODE_REF_KEY);
key.offset = 0;
key.offset = (u64)-1;
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
BUG_ON(ret == 0);
leaf = path->nodes[0];
slot = path->slots[0];
nritems = btrfs_header_nritems(leaf);
if (slot >= nritems) {
if (ret < 0 || path->slots[0] == 0) {
btrfs_release_path(root, path);
goto read_dir_items;
}
BUG_ON(ret == 0);
leaf = path->nodes[0];
slot = path->slots[0] - 1;
btrfs_item_key_to_cpu(leaf, &found_key, slot);
btrfs_release_path(root, path);
if (found_key.objectid != key.objectid ||
Expand Down

0 comments on commit 6226783

Please sign in to comment.