Blame SOURCES/e2fsprogs-1.42.9-14-libext2fs-fix-maximum-bg-overhead-calculation-with-m.patch

98901c
From 80f665e8365607a9885ca6a136cdeffacf9860d6 Mon Sep 17 00:00:00 2001
98901c
From: "Darrick J. Wong" <darrick.wong@oracle.com>
98901c
Date: Sat, 24 Oct 2015 00:24:57 -0400
98901c
Subject: [PATCH 02/16] libext2fs: fix maximum bg overhead calculation with
98901c
 meta_bg enabled
98901c
98901c
commit 1abdd04eb1d19488493022f81c03f5b80aa7fcc7
98901c
98901c
When meta_bg is enabled at mkfs time, we put at most one group
98901c
descriptor block in each blockgroup.  Unfortunately, the calculation
98901c
of max overhead per bg doesn't know this, so mkfs fails when it isn't
98901c
strictly necessary.  Fix it, since Dave reported that he couldn't
98901c
create a 500TB ext4 filesystem.
98901c
98901c
Reported-by: Dave Chinner <david@fromorbit.com>
98901c
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
98901c
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
98901c
---
98901c
 lib/ext2fs/initialize.c | 7 ++++++-
98901c
 1 file changed, 6 insertions(+), 1 deletion(-)
98901c
98901c
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
98901c
index 2db8b3c2..3548c56c 100644
98901c
--- a/lib/ext2fs/initialize.c
98901c
+++ b/lib/ext2fs/initialize.c
98901c
@@ -377,7 +377,12 @@ ipg_retry:
98901c
 	 * table, and the reserved gdt blocks.
98901c
 	 */
98901c
 	overhead = (int) (3 + fs->inode_blocks_per_group +
98901c
-			  fs->desc_blocks + super->s_reserved_gdt_blocks);
98901c
+			  super->s_reserved_gdt_blocks);
98901c
+
98901c
+	if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
98901c
+		overhead++;
98901c
+	else
98901c
+		overhead += fs->desc_blocks;
98901c
 
98901c
 	/* This can only happen if the user requested too many inodes */
98901c
 	if (overhead > super->s_blocks_per_group) {
98901c
-- 
98901c
2.20.1
98901c