]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Btrfs: fix double increment of path->slots[0] in btrfs_next_leaf
authorYan Zheng <zheng.yan@oracle.com>
Wed, 22 Jul 2009 13:59:00 +0000 (09:59 -0400)
committerChris Mason <chris.mason@oracle.com>
Wed, 22 Jul 2009 13:59:00 +0000 (09:59 -0400)
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>
fs/btrfs/ctree.c

index 60a45f3a4e916fe9af5a8c644b3a8eb9b5b73f81..7bb66c65ddfda1068077cceb9909b9a89464cd26 100644 (file)
@@ -4146,7 +4146,8 @@ again:
         * 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;
        }