From: Darrick J. Wong Date: Sat, 24 Oct 2015 04:30:02 +0000 (-0400) Subject: libext2fs: automatically enable meta_bg to avoid filling up BG 0 X-Git-Tag: v1.43-WIP-2016-03-15~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03940aac5492879ef365b07e69105a98f4dbabf9;p=thirdparty%2Fe2fsprogs.git libext2fs: automatically enable meta_bg to avoid filling up BG 0 If during formatting we'd lose more than 75% a block group to group descriptors and other metadata, enable the meta_bg feature. This enables us to create >500T filesystems with default options. Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c index f672a2790..b5ca92801 100644 --- a/lib/ext2fs/initialize.c +++ b/lib/ext2fs/initialize.c @@ -381,6 +381,11 @@ ipg_retry: overhead = (int) (3 + fs->inode_blocks_per_group + super->s_reserved_gdt_blocks); + /* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */ + if (super->s_reserved_gdt_blocks + fs->desc_blocks > + super->s_blocks_per_group * 3 / 4) + fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG; + if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) overhead++; else