From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: tytso@mit.edu, darrick.wong@oracle.com
Cc: linux-ext4@vger.kernel.org, Dave Chinner <david@fromorbit.com>
Subject: [PATCH 01/12] libext2fs: fix maximum bg overhead calculation with meta_bg enabled
Date: Mon, 12 Oct 2015 14:56:35 -0700	[thread overview]
Message-ID: <20151012215635.29065.41295.stgit@birch.djwong.org> (raw)
In-Reply-To: <20151012215629.29065.24418.stgit@birch.djwong.org>
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) {
next prev parent reply	other threads:[~2015-10-12 21:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 21:56 [PATCH 00/12] e2fsprogs: misc fixes and cleanups; save checksum seeds Darrick J. Wong
2015-10-12 21:56 ` Darrick J. Wong [this message]
2015-10-24  4:37   ` [PATCH 01/12] libext2fs: fix maximum bg overhead calculation with meta_bg enabled Theodore Ts'o
2015-10-12 21:56 ` [PATCH 02/12] libext2fs: automatically enable meta_bg to avoid filling up BG 0 Darrick J. Wong
2015-10-13  2:34   ` Andreas Dilger
2015-10-13  7:08     ` Darrick J. Wong
2015-10-24  4:38   ` Theodore Ts'o
2015-10-12 21:56 ` [PATCH 03/12] libext2fs: clean up feature test macros with predicate functions Darrick J. Wong
2015-10-24  4:41   ` Theodore Ts'o
2015-10-12 21:56 ` [PATCH 04/12] e2fsck: " Darrick J. Wong
2015-10-24  4:49   ` Theodore Ts'o
2015-10-12 21:57 ` [PATCH 05/12] misc: " Darrick J. Wong
2015-10-24  5:24   ` Theodore Ts'o
2015-10-12 21:57 ` [PATCH 06/12] resize2fs: " Darrick J. Wong
2015-10-24  5:24   ` Theodore Ts'o
2015-10-12 21:57 ` [PATCH 07/12] debugfs: " Darrick J. Wong
2015-10-24  5:26   ` Theodore Ts'o
2015-10-12 21:57 ` [PATCH 08/12] libext2fs: store checksum seed in superblock Darrick J. Wong
2015-10-12 21:57 ` [PATCH 09/12] tune2fs: allow user to turn on saving the checksum seed Darrick J. Wong
2015-10-12 21:57 ` [PATCH 10/12] e2fsck: check the checksum seed feature flag is set correctly Darrick J. Wong
2015-10-12 21:57 ` [PATCH 11/12] mke2fs: store checksum seed at format time Darrick J. Wong
2015-10-12 21:57 ` [PATCH 12/12] tests: check proper operation of metadata_csum_seed Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=20151012215635.29065.41295.stgit@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
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).