]> git.hungrycats.org Git - linux/commitdiff
Revert "Btrfs: do not start a transaction at iterate_extent_inodes()"
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 6 Dec 2019 20:16:08 +0000 (15:16 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sat, 7 Dec 2019 01:12:49 +0000 (20:12 -0500)
This reverts commit bfc61c36260ca990937539cd648ede3cd749bc10.

(cherry picked from commit 9ad6e14f3f1ad6a90c8530b8c8f925e99dd4062f)

fs/btrfs/backref.c

index ded46efac27de426758880bd093aba2e22a5a50d..c854f74ab772b27424e74077a395635255f25db5 100644 (file)
@@ -1913,19 +1913,13 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
                        extent_item_objectid);
 
        if (!search_commit_root) {
-               trans = btrfs_attach_transaction(fs_info->extent_root);
-               if (IS_ERR(trans)) {
-                       if (PTR_ERR(trans) != -ENOENT &&
-                           PTR_ERR(trans) != -EROFS)
-                               return PTR_ERR(trans);
-                       trans = NULL;
-               }
-       }
-
-       if (trans)
+               trans = btrfs_join_transaction(fs_info->extent_root);
+               if (IS_ERR(trans))
+                       return PTR_ERR(trans);
                btrfs_get_tree_mod_seq(fs_info, &tree_mod_seq_elem);
-       else
+       } else {
                down_read(&fs_info->commit_root_sem);
+       }
 
        ret = btrfs_find_all_leafs(trans, fs_info, extent_item_objectid,
                                   tree_mod_seq_elem.seq, &refs,
@@ -1958,7 +1952,7 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
 
        free_leaf_list(refs);
 out:
-       if (trans) {
+       if (!search_commit_root) {
                btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem);
                btrfs_end_transaction(trans);
        } else {