]> git.hungrycats.org Git - linux/commitdiff
Revert "btrfs: run delayed refs less often in commit_cowonly_roots"
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 5 Dec 2021 08:07:34 +0000 (03:07 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 5 Dec 2021 08:07:34 +0000 (03:07 -0500)
This reverts commit 7309dd9d676ea091857c0f0752272b4b50e723ac.

fs/btrfs/transaction.c

index b40f91b1277a7c3b34954ce3c72a5764942b6097..4b5db4d1aa619b9bc7d0914fd622f2792742f4ba 100644 (file)
@@ -1226,6 +1226,10 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans)
        btrfs_tree_unlock(eb);
        free_extent_buffer(eb);
 
+       if (ret)
+               return ret;
+
+       ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
        if (ret)
                return ret;
 
@@ -1243,6 +1247,10 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans)
        if (ret)
                return ret;
 
+       /* run_qgroups might have added some more refs */
+       ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
+       if (ret)
+               return ret;
 again:
        while (!list_empty(&fs_info->dirty_cowonly_roots)) {
                struct btrfs_root *root;
@@ -1257,24 +1265,15 @@ again:
                ret = update_cowonly_root(trans, root);
                if (ret)
                        return ret;
+               ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
+               if (ret)
+                       return ret;
        }
 
-       /* Now flush any delayed refs generated by updating all of the roots */
-       ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
-       if (ret)
-               return ret;
-
        while (!list_empty(dirty_bgs) || !list_empty(io_bgs)) {
                ret = btrfs_write_dirty_block_groups(trans);
                if (ret)
                        return ret;
-
-               /*
-                * We're writing the dirty block groups, which could generate
-                * delayed refs, which could generate more dirty block groups,
-                * so we want to keep this flushing in this loop to make sure
-                * everything gets run.
-                */
                ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
                if (ret)
                        return ret;