diff mbox series

[4/5] btrfs: make calc_available_free_space available outside of space-info

Message ID c77bf5c2e069891e6885197dbb080f8847bf7b7b.1647878642.git.johannes.thumshirn@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs: rework background block group relocation | expand

Commit Message

Johannes Thumshirn March 21, 2022, 4:14 p.m. UTC
Make calc_available_free_space available outside of space-info.c and
rename to btrfs_calc_available_free_space.

This is a preparation for the next commit and does not impose any
functional changes.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/btrfs/space-info.c | 8 ++++----
 fs/btrfs/space-info.h | 4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Josef Bacik March 22, 2022, 5:34 p.m. UTC | #1
On Mon, Mar 21, 2022 at 09:14:13AM -0700, Johannes Thumshirn wrote:
> Make calc_available_free_space available outside of space-info.c and
> rename to btrfs_calc_available_free_space.
> 
> This is a preparation for the next commit and does not impose any
> functional changes.
> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
diff mbox series

Patch

diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 60d0a58c4644..e1fd1b1681fd 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -301,7 +301,7 @@  struct btrfs_space_info *btrfs_find_space_info(struct btrfs_fs_info *info,
 	return NULL;
 }
 
-static u64 calc_available_free_space(struct btrfs_fs_info *fs_info,
+u64 btrfs_calc_available_free_space(struct btrfs_fs_info *fs_info,
 			  struct btrfs_space_info *space_info,
 			  enum btrfs_reserve_flush_enum flush)
 {
@@ -349,7 +349,7 @@  int btrfs_can_overcommit(struct btrfs_fs_info *fs_info,
 		return 0;
 
 	used = btrfs_space_info_used(space_info, true);
-	avail = calc_available_free_space(fs_info, space_info, flush);
+	avail = btrfs_calc_available_free_space(fs_info, space_info, flush);
 
 	if (used + bytes < space_info->total_bytes + avail)
 		return 1;
@@ -722,7 +722,7 @@  btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info,
 
 	lockdep_assert_held(&space_info->lock);
 
-	avail = calc_available_free_space(fs_info, space_info,
+	avail = btrfs_calc_available_free_space(fs_info, space_info,
 					  BTRFS_RESERVE_FLUSH_ALL);
 	used = btrfs_space_info_used(space_info, true);
 
@@ -803,7 +803,7 @@  static bool need_preemptive_reclaim(struct btrfs_fs_info *fs_info,
 	 * much delalloc we need for the background flusher to kick in.
 	 */
 
-	thresh = calc_available_free_space(fs_info, space_info,
+	thresh = btrfs_calc_available_free_space(fs_info, space_info,
 					   BTRFS_RESERVE_FLUSH_ALL);
 	used = space_info->bytes_used + space_info->bytes_reserved +
 	       space_info->bytes_readonly + global_rsv_size;
diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
index 0c45f539e3cf..a957d84d8ff0 100644
--- a/fs/btrfs/space-info.h
+++ b/fs/btrfs/space-info.h
@@ -151,4 +151,8 @@  static inline void btrfs_space_info_free_bytes_may_use(
 }
 int btrfs_reserve_data_bytes(struct btrfs_fs_info *fs_info, u64 bytes,
 			     enum btrfs_reserve_flush_enum flush);
+
+u64 btrfs_calc_available_free_space(struct btrfs_fs_info *fs_info,
+				    struct btrfs_space_info *space_info,
+				    enum btrfs_reserve_flush_enum flush);
 #endif /* BTRFS_SPACE_INFO_H */