]> 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>
Sun, 8 Dec 2019 03:18:37 +0000 (22:18 -0500)
This reverts commit bfc61c36260ca990937539cd648ede3cd749bc10.

(cherry picked from commit 9ad6e14f3f1ad6a90c8530b8c8f925e99dd4062f)

fs/btrfs/backref.c

index efe4d4080a2140c41a724ba29d12565498aa854e..955f08b4fb076dd1688468f21d1bf34ac8197fa0 100644 (file)
@@ -1915,19 +1915,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,
@@ -1960,7 +1954,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 {