]> git.hungrycats.org Git - linux/commitdiff
Revert "Btrfs: fix ASSERT(list_empty(&cur_trans->dirty_bgs_list)"
authorZygo Blaxell <zblaxell@serenity.furryterror.org>
Sun, 29 Mar 2015 16:12:05 +0000 (12:12 -0400)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Sun, 29 Mar 2015 16:12:05 +0000 (12:12 -0400)
This reverts commit 6ed5d549f5f96d0fe521868155cb5680b44283c7.

fs/btrfs/transaction.c

index 36d0d80cd2b94843df1476d5d53f040402882856..3babe8f817b0ec630d0526419d81279a5980495a 100644 (file)
@@ -958,6 +958,7 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans,
        u64 old_root_bytenr;
        u64 old_root_used;
        struct btrfs_root *tree_root = root->fs_info->tree_root;
+       bool extent_root = (root->objectid == BTRFS_EXTENT_TREE_OBJECTID);
 
        old_root_used = btrfs_root_used(&root->root_item);
        btrfs_write_dirty_block_groups(trans, root);
@@ -976,6 +977,14 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans,
                        return ret;
 
                old_root_used = btrfs_root_used(&root->root_item);
+               if (extent_root) {
+                       ret = btrfs_write_dirty_block_groups(trans, root);
+                       if (ret)
+                               return ret;
+               }
+               ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1);
+               if (ret)
+                       return ret;
        }
 
        return 0;
@@ -992,7 +1001,6 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans,
                                         struct btrfs_root *root)
 {
        struct btrfs_fs_info *fs_info = root->fs_info;
-       struct list_head *dirty_bgs = &trans->transaction->dirty_bgs;
        struct list_head *next;
        struct extent_buffer *eb;
        int ret;
@@ -1028,7 +1036,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans,
        ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1);
        if (ret)
                return ret;
-again:
+
        while (!list_empty(&fs_info->dirty_cowonly_roots)) {
                next = fs_info->dirty_cowonly_roots.next;
                list_del_init(next);
@@ -1041,23 +1049,8 @@ again:
                ret = update_cowonly_root(trans, root);
                if (ret)
                        return ret;
-               ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1);
-               if (ret)
-                       return ret;
        }
 
-       while (!list_empty(dirty_bgs)) {
-               ret = btrfs_write_dirty_block_groups(trans, root);
-               if (ret)
-                       return ret;
-               ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1);
-               if (ret)
-                       return ret;
-       }
-
-       if (!list_empty(&fs_info->dirty_cowonly_roots))
-               goto again;
-
        list_add_tail(&fs_info->extent_root->dirty_list,
                      &trans->transaction->switch_commits);
        btrfs_after_dev_replace_commit(fs_info);