diff options
author | Qu Wenruo <wqu@suse.com> | 2017-10-12 14:24:34 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-01-03 17:10:11 +0100 |
commit | 31d228a2eb98d95637338bf77b5abcd375614d15 (patch) | |
tree | 8a22f1014b9be4c945582df1def60b566ce3b2ce /mkfs/common.h | |
parent | 2c2db167c79bee6c0ce88f55f964135908654f74 (diff) |
btrfs-progs: mkfs: Enhance minimal device size calculation to fix mkfs failure on small file
Since commit c11e36a29e84 ("Btrfs-progs: Do not force mixed block group
creation unless '-M' option is specified"), mkfs no longer use mixed
block group unless specified manually.
This breaks the minimal device size calculation, which only considered
mixed block group use case.
This patch enhances minimal device size calculation for mkfs, by using
different minimal stripe length (calculated from code) for different
profiles, and use them to calculate minimal device size.
Reported-by: Wesley Aptekar-Cassels <W.Aptekar@gmail.com>
Fixes: c11e36a29e84 ("Btrfs-progs: Do not force mixed block group creation unless '-M' option is specified")
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
[ updated comments ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'mkfs/common.h')
-rw-r--r-- | mkfs/common.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mkfs/common.h b/mkfs/common.h index d63c5ebb..f6b60c28 100644 --- a/mkfs/common.h +++ b/mkfs/common.h @@ -66,8 +66,8 @@ struct btrfs_mkfs_config { }; int make_btrfs(int fd, struct btrfs_mkfs_config *cfg); -u64 btrfs_min_dev_size(u32 nodesize); -u64 btrfs_min_global_blk_rsv_size(u32 nodesize); +u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile, + u64 data_profile); int test_minimum_size(const char *file, u64 min_dev_size); int is_vol_small(const char *file); int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile, |