xfsprogs/0037-mkfs-complain-about-impossible-log-size-constraints.patch
wguanghao 7fbd36818a backport patches from community
(cherry picked from commit cc60985a665f17f23031c03f1021e886d63b990f)
2023-12-27 16:29:57 +08:00

41 lines
1.4 KiB
Diff

From db5b866537e78669f7b84590345b0c37f841f701 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <djwong@kernel.org>
Date: Thu, 4 Aug 2022 21:28:23 -0500
Subject: [PATCH] mkfs: complain about impossible log size constraints
xfs/042 trips over an impossible fs geometry when nrext64 is enabled.
The minimum log size calculation comes out to 4287 blocks, but the mkfs
parameters specify an AG size of 4096 blocks. This eventually causes
mkfs to complain that the autoselected log size doesn't meet the minimum
size, but we could be a little more explicit in pointing out that the
two size constraints make for an impossible geometry.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
mkfs/xfs_mkfs.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 12994ed..9dd0e79 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -3490,6 +3490,13 @@ _("external log device size %lld blocks too small, must be at least %lld blocks\
* an AG.
*/
max_logblocks = libxfs_alloc_ag_max_usable(mp) - 1;
+ if (max_logblocks < min_logblocks) {
+ fprintf(stderr,
+_("max log size %d smaller than min log size %d, filesystem is too small\n"),
+ max_logblocks,
+ min_logblocks);
+ usage();
+ }
/* internal log - if no size specified, calculate automatically */
if (!cfg->logblocks) {
--
1.8.3.1