Skip to content

Commit

Permalink
Btrfs: fix double increment of path->slots[0] in btrfs_next_leaf
Browse files Browse the repository at this point in the history
if 1 is returned by btrfs_search_slot, the path already points to the
first item with 'key > searching key'. So increasing path->slots[0] by
one is superfluous in that case.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Yan Zheng authored and Chris Mason committed Jul 22, 2009
1 parent bf1fb51 commit e457afe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4146,7 +4146,8 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
* advance the path if there are now more items available.
*/
if (nritems > 0 && path->slots[0] < nritems - 1) {
path->slots[0]++;
if (ret == 0)
path->slots[0]++;
ret = 0;
goto done;
}
Expand Down

0 comments on commit e457afe

Please sign in to comment.