diff mbox series

[v5,4/4] btrfs: increase metadata alloc size to 5GB for volumes > 50GB

Message ID 20211109220218.602995-5-shr@fb.com (mailing list archive)
State New, archived
Headers show
Series btrfs: sysfs: set / query btrfs chunk size | expand

Commit Message

Stefan Roesch Nov. 9, 2021, 10:02 p.m. UTC
This increases the metadata default allocation size from 1GB to 5GB for
volumes with a size greater than 50GB.

Signed-off-by: Stefan Roesch <shr@fb.com>
---
 fs/btrfs/space-info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wang Yugui Nov. 10, 2021, 5:02 a.m. UTC | #1
Hi,

We chose  5ULL * SZ_1G because it is a half of
BTRFS_MAX_DATA_CHUNK_SIZE(10G)?

A same chunk size of data/metadata maybe better for long-term alloc/free?
so the following mabye better.

 	/* Handle BTRFS_BLOCK_GROUP_METADATA */
 	if (info->fs_devices->total_rw_bytes > 2048ULL * SZ_1G)
-		return SZ_1G;
+		return BTRFS_MAX_DATA_CHUNK_SIZE;

by the way, we need to update btrfs-progs to apply this new policy from
mkfs.btrfs.

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2021/11/10

> This increases the metadata default allocation size from 1GB to 5GB for
> volumes with a size greater than 50GB.
> 
> Signed-off-by: Stefan Roesch <shr@fb.com>
> ---
>  fs/btrfs/space-info.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
> index 3a31aea701a8..0d0accbe3bfb 100644
> --- a/fs/btrfs/space-info.c
> +++ b/fs/btrfs/space-info.c
> @@ -195,7 +195,7 @@ static u64 compute_chunk_size_regular(struct btrfs_fs_info *info, u64 flags)
>  
>  	/* Handle BTRFS_BLOCK_GROUP_METADATA */
>  	if (info->fs_devices->total_rw_bytes > 50ULL * SZ_1G)
> -		return SZ_1G;
> +		return 5ULL * SZ_1G;
>  
>  	return SZ_256M;
>  }
> -- 
> 2.30.2
diff mbox series

Patch

diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 3a31aea701a8..0d0accbe3bfb 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -195,7 +195,7 @@  static u64 compute_chunk_size_regular(struct btrfs_fs_info *info, u64 flags)
 
 	/* Handle BTRFS_BLOCK_GROUP_METADATA */
 	if (info->fs_devices->total_rw_bytes > 50ULL * SZ_1G)
-		return SZ_1G;
+		return 5ULL * SZ_1G;
 
 	return SZ_256M;
 }