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

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