summaryrefslogtreecommitdiff
path: root/mkfs/main.c
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2017-10-12 14:24:34 +0800
committerDavid Sterba <dsterba@suse.com>2018-01-03 17:10:11 +0100
commit31d228a2eb98d95637338bf77b5abcd375614d15 (patch)
tree8a22f1014b9be4c945582df1def60b566ce3b2ce /mkfs/main.c
parent2c2db167c79bee6c0ce88f55f964135908654f74 (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/main.c')
-rw-r--r--mkfs/main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mkfs/main.c b/mkfs/main.c
index e405e5a2..90fab59b 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1668,7 +1668,8 @@ int main(int argc, char **argv)
goto error;
}
- min_dev_size = btrfs_min_dev_size(nodesize);
+ min_dev_size = btrfs_min_dev_size(nodesize, mixed, metadata_profile,
+ data_profile);
/* Check device/block_count after the nodesize is determined */
if (block_count && block_count < min_dev_size) {
error("size %llu is too small to make a usable filesystem",