btrfs: run delayed refs less often in commit_cowonly_roots
authorJosef Bacik <josef@toxicpanda.com>
Fri, 18 Dec 2020 19:24:26 +0000 (14:24 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 8 Feb 2021 21:58:57 +0000 (22:58 +0100)
commit488bc2a2d21e5faf14f9f695bb592ae9dd0e7465
tree507f01f21358c5def8d34849ac75f731108535ce
parentdac348e9257051e7a39224747695b53e3fc737d7
btrfs: run delayed refs less often in commit_cowonly_roots

We love running delayed refs in commit_cowonly_roots, but it is a bit
excessive.  I was seeing cases of running 3 or 4 refs a few times in a
row during this time.  Instead simply:

- update all of the roots first
- then run delayed refs
- then handle the empty block groups case
- and then if we have any more dirty roots do the whole thing again

This allows us to be much more efficient with our delayed ref running,
as we can batch a few more operations at once.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/transaction.c