Blame SOURCES/e2fsprogs-1.42.9-14-libext2fs-automatically-enable-meta_bg-to-avoid-fill.patch

0ef434
From 4198ce4de86d2144ce127bba0d263a005926acf2 Mon Sep 17 00:00:00 2001
0ef434
From: "Darrick J. Wong" <darrick.wong@oracle.com>
0ef434
Date: Sat, 24 Oct 2015 00:30:02 -0400
0ef434
Subject: [PATCH 03/16] libext2fs: automatically enable meta_bg to avoid
0ef434
 filling up BG 0
0ef434
0ef434
commit 03940aac5492879ef365b07e69105a98f4dbabf9
0ef434
0ef434
If during formatting we'd lose more than 75% a block group to group
0ef434
descriptors and other metadata, enable the meta_bg feature.  This
0ef434
enables us to create >500T filesystems with default options.
0ef434
0ef434
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
0ef434
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
0ef434
---
0ef434
 lib/ext2fs/initialize.c | 5 +++++
0ef434
 1 file changed, 5 insertions(+)
0ef434
0ef434
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
0ef434
index 3548c56c..0b8355d8 100644
0ef434
--- a/lib/ext2fs/initialize.c
0ef434
+++ b/lib/ext2fs/initialize.c
0ef434
@@ -379,6 +379,11 @@ ipg_retry:
0ef434
 	overhead = (int) (3 + fs->inode_blocks_per_group +
0ef434
 			  super->s_reserved_gdt_blocks);
0ef434
 
0ef434
+	/* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
0ef434
+	if (super->s_reserved_gdt_blocks + fs->desc_blocks >
0ef434
+	    super->s_blocks_per_group * 3 / 4)
0ef434
+		fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
0ef434
+
0ef434
 	if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
0ef434
 		overhead++;
0ef434
 	else
0ef434
-- 
0ef434
2.20.1
0ef434