Mkfs tends to create pretty large metadata chunk compared to kernel:
Node size: 16384
Sector size: 4096
Filesystem size: 10.00GiB
Block group profiles:
Data: single 8.00MiB
Metadata: DUP 1.00GiB
System: DUP 8.00MiB
While kernel only tends to create 256MiB metadata chunk:
/* for larger filesystems, use larger metadata chunks */
if (fs_devices->total_rw_bytes > 50ULL * SZ_1G)
max_stripe_size = SZ_1G;
else
max_stripe_size = SZ_256M;
This won't cause problems in real world, but it's still better to make
the behavior unified.
Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
---
volumes.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/volumes.c b/volumes.c
index 2611a932c01c..3a91b43b378b 100644
--- a/volumes.c
+++ b/volumes.c
@@ -989,8 +989,12 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
min_stripe_size = SZ_64M;
max_stripes = BTRFS_MAX_DEVS(info);
} else if (type & BTRFS_BLOCK_GROUP_METADATA) {
- calc_size = SZ_1G;
- max_chunk_size = 4 * calc_size;
+ /* for larger filesystems, use larger metadata chunks */
+ if (info->fs_devices->total_rw_bytes > 50ULL * SZ_1G)
+ max_chunk_size = SZ_1G;
+ else
+ max_chunk_size = SZ_256M;
+ calc_size = max_chunk_size;
min_stripe_size = SZ_32M;
max_stripes = BTRFS_MAX_DEVS(info);
}
--
2.20.1