btrfs-progs: mkfs: Enhance minimal device size calculation to fix mkfs failure on...
authorQu Wenruo <wqu@suse.com>
Thu, 12 Oct 2017 06:24:34 +0000 (14:24 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 3 Jan 2018 16:10:11 +0000 (17:10 +0100)
commit31d228a2eb98d95637338bf77b5abcd375614d15
tree8a22f1014b9be4c945582df1def60b566ce3b2ce
parent2c2db167c79bee6c0ce88f55f964135908654f74
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>
mkfs/common.c
mkfs/common.h
mkfs/main.c