diff options
author | Josef Bacik <josef@toxicpanda.com> | 2020-12-18 14:24:21 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-02-08 22:58:56 +0100 |
commit | 61a56a992fcfc694a54de77d896350b9d0588e86 (patch) | |
tree | 0b11b060a3a0fb52fc08c2d540ef3ffafa0e0d05 | |
parent | e19eb11f4f3d3b0463cd897016064a79cb6d8c6d (diff) | |
download | linux-61a56a992fcfc694a54de77d896350b9d0588e86.tar.bz2 |
btrfs: delayed refs pre-flushing should only run the heads we have
Previously our delayed ref running used the total number of items as the
items to run. However we changed that to number of heads to run with
the delayed_refs_rsv, as generally we want to run all of the operations
for one bytenr.
But with btrfs_run_delayed_refs(trans, 0) we set our count to 2x the
number of items that we have. This is generally fine, but if we have
some operation generation loads of delayed refs while we're doing this
pre-flushing in the transaction commit, we'll just spin forever doing
delayed refs.
Fix this to simply pick the number of delayed refs we currently have,
that way we do not end up doing a lot of extra work that's being
generated in other threads.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/extent-tree.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 6f0c59debc2b..0943731f7edd 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2113,7 +2113,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, delayed_refs = &trans->transaction->delayed_refs; if (count == 0) - count = atomic_read(&delayed_refs->num_entries) * 2; + count = delayed_refs->num_heads_ready; again: #ifdef SCRAMBLE_DELAYED_REFS |