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

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