Merge branch 'for-chris-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/fdmana...
[linux-2.6-block.git] / fs / btrfs / tree-log.c
index f7324189413c842b269c856681e017e62b04cc1b..f10bf5213ed8a48b95a8cf3cf51dc3c2c81b8463 100644 (file)
@@ -1948,12 +1948,11 @@ static noinline int find_dir_range(struct btrfs_root *root,
 next:
        /* check the next slot in the tree to see if it is a valid item */
        nritems = btrfs_header_nritems(path->nodes[0]);
+       path->slots[0]++;
        if (path->slots[0] >= nritems) {
                ret = btrfs_next_leaf(root, path);
                if (ret)
                        goto out;
-       } else {
-               path->slots[0]++;
        }
 
        btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
@@ -5224,6 +5223,7 @@ process_leaf:
                        if (di_key.type == BTRFS_ROOT_ITEM_KEY)
                                continue;
 
+                       btrfs_release_path(path);
                        di_inode = btrfs_iget(fs_info->sb, &di_key, root, NULL);
                        if (IS_ERR(di_inode)) {
                                ret = PTR_ERR(di_inode);
@@ -5232,13 +5232,12 @@ process_leaf:
 
                        if (btrfs_inode_in_log(di_inode, trans->transid)) {
                                iput(di_inode);
-                               continue;
+                               break;
                        }
 
                        ctx->log_new_dentries = false;
                        if (type == BTRFS_FT_DIR || type == BTRFS_FT_SYMLINK)
                                log_mode = LOG_INODE_ALL;
-                       btrfs_release_path(path);
                        ret = btrfs_log_inode(trans, root, di_inode,
                                              log_mode, 0, LLONG_MAX, ctx);
                        if (!ret &&