Message ID | 20200313212330.149024-5-josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Throttle delayed refs based on time | expand |
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);
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@toxicpanda.com> --- fs/btrfs/transaction.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)