You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4 KiB

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