* [PATCH] libext2fs: fix maximum bg overhead calculation with meta_bg enabled in ext2fs_initialize
@ 2015-09-19 5:26 Darrick J. Wong
0 siblings, 0 replies; only message in thread
From: Darrick J. Wong @ 2015-09-19 5:26 UTC (permalink / raw)
To: tytso; +Cc: linux-ext4, Dave Chinner
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>
---
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 75fbf8e..f672a27 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -379,7 +379,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) {
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-19 5:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-19 5:26 [PATCH] libext2fs: fix maximum bg overhead calculation with meta_bg enabled in ext2fs_initialize Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).