Currently snapshot deletion checks to see if it needs to throttle itself
before ending a transaction, however this only checks if there's enough
space for delayed refs, not how much time it'll take to run those
delayed refs. Fix this by checking btrfs_should_throttle_delayed_refs
as well, which takes into account how much time it'll take to run
delayed refs.
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
---
fs/btrfs/transaction.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 8d34d7e0adb6..309a2a60040f 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -859,7 +859,8 @@ static int should_end_transaction(struct btrfs_trans_handle *trans)
{
struct btrfs_fs_info *fs_info = trans->fs_info;
- if (btrfs_check_space_for_delayed_refs(fs_info))
+ if (btrfs_should_throttle_delayed_refs(trans) ||
+ btrfs_check_space_for_delayed_refs(fs_info))
return 1;
return !!btrfs_block_rsv_check(&fs_info->global_block_rsv, 5);
--
2.24.1