btrfs-progs: Unify metadata chunk size with kernel

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@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
master
Qu Wenruo 2019-02-05 14:53:12 +08:00 committed by David Sterba
parent 0dd9031159
commit 3ef4bd5cb8
1 changed files with 6 additions and 2 deletions

View File

@ -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);
}