[PATCH 03/13] btrfs: make btrfs_should_throttle_delayed_refs only check run time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 fs/btrfs/delayed-ref.c | 3 +--
 fs/btrfs/inode.c       | 3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index acad9978b927..e28565dc4288 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -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;
 }
 
 /**
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b8dabffac767..d3e75e04a0a0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -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;
 			}
 		}
-- 
2.24.1




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux