@@ -64,8 +64,7 @@ bool btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans)
return true;
if (val >= NSEC_PER_SEC / 2)
return true;
-
- return btrfs_check_space_for_delayed_refs(trans->fs_info);
+ return false;
}
/**
@@ -4349,7 +4349,8 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
break;
}
if (be_nice) {
- if (btrfs_should_throttle_delayed_refs(trans))
+ if (btrfs_should_throttle_delayed_refs(trans) ||
+ btrfs_check_space_for_delayed_refs(fs_info))
should_throttle = true;
}
}
btrfs_should_throttle_delayed_refs checks run time of the delayed refs and if there's enough space. However we want to use these two checks independently in the future, so make btrfs_should_throttle_delayed_refs only check the runtime. Then fix the only caller of btrfs_should_throttle_delayed_refs to check the space as well, because we want to throttle truncates on either space or time. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/delayed-ref.c | 3 +-- fs/btrfs/inode.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-)