From: "Darrick J. Wong" <djwong@kernel.org>
To: sandeen@sandeen.net
Cc: Catherine Hoang <catherine.hoang@oracle.com>, linux-xfs@vger.kernel.org
Subject: [PATCH v1.1 6/4] mkfs: round log size down if rounding log start up causes overflow
Date: Wed, 20 Apr 2022 10:29:28 -0700 [thread overview]
Message-ID: <20220420172928.GS17025@magnolia> (raw)
In-Reply-To: <164996213753.226891.14458233911347178679.stgit@magnolia>
From: Darrick J. Wong <djwong@kernel.org>
If rounding the log start up to the next stripe unit would cause the log
to overrun the end of the AG, round the log size down by a stripe unit.
We already ensured that logblocks was small enough to fit inside the AG,
so the minor adjustment should suffice.
This can be reproduced with:
mkfs.xfs -dsu=44k,sw=1,size=300m,file,name=fsfile -m rmapbt=0
and:
mkfs.xfs -dsu=48k,sw=1,size=512m,file,name=fsfile -m rmapbt=0
Reported-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
mkfs/xfs_mkfs.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index b932acaa..01d2e8ca 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -3234,6 +3234,15 @@ _("Due to stripe alignment, the internal log start (%lld) cannot be aligned\n"
/* round up/down the log size now */
align_log_size(cfg, sunit, max_logblocks);
+ /*
+ * If the end of the log has been rounded up past the end of the AG,
+ * reduce logblocks by a stripe unit to try to get it back under EOAG.
+ */
+ if (!libxfs_verify_fsbext(mp, cfg->logstart, cfg->logblocks) &&
+ cfg->logblocks > sunit) {
+ cfg->logblocks -= sunit;
+ }
+
/* check the aligned log still starts and ends in the same AG. */
if (!libxfs_verify_fsbext(mp, cfg->logstart, cfg->logblocks)) {
fprintf(stderr,
prev parent reply other threads:[~2022-04-20 17:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-14 18:48 [PATCHSET 0/4] mkfs: various bug fixes Darrick J. Wong
2022-04-14 18:49 ` [PATCH 1/4] mkfs: fix missing validation of -l size against maximum internal log size Darrick J. Wong
2022-04-24 5:41 ` Christoph Hellwig
2022-04-14 18:49 ` [PATCH 2/4] mkfs: reduce internal log size when log stripe units are in play Darrick J. Wong
2022-04-24 5:41 ` Christoph Hellwig
2022-04-14 18:49 ` [PATCH 3/4] mkfs: don't let internal logs bump the root dir inode chunk to AG 1 Darrick J. Wong
2022-04-24 5:42 ` Christoph Hellwig
2022-04-14 18:49 ` [PATCH 4/4] mkfs: don't trample the gid set in the protofile Darrick J. Wong
2022-04-15 16:43 ` Catherine Hoang
2022-04-24 5:43 ` Christoph Hellwig
2022-04-15 23:57 ` [PATCH 5/4] mkfs: improve log extent validation Darrick J. Wong
2022-04-24 5:43 ` Christoph Hellwig
2022-04-15 23:57 ` [PATCH 6/4] mkfs: round log size down if rounding log start up causes overflow Darrick J. Wong
2022-04-20 17:27 ` Darrick J. Wong
2022-04-20 17:29 ` Darrick J. Wong [this message]
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=20220420172928.GS17025@magnolia \
--to=djwong@kernel.org \
--cc=catherine.hoang@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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