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

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