Skip to contentSkip to conversation

mkfs: warning about misaligned AGs and RAID stripes is not an error

PATCH In review Darrick J. Wong 2 participants 2 messages Apr 27, 2023 – Apr 28, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkfs: warning about misaligned AGs and RAID stripes is not an error

From: Darrick J. Wong <[email protected]>

I've noticed a fair number of fstests failures when we create a scratch device on a RAID device and the test specifies an explicit AG count or AG size:

var/tmp/fstests/xfs/042.out.bad renamed from tmp/fstests/tests/xfs/042.out +4 -1
@@ -1,5 +1,8 @@
 QA output created by 042
-Make a 96 megabyte filesystem on SCRATCH_DEV and mount... done
+Make a 96 megabyte filesystem on SCRATCH_DEV and mount... Warning: AG size is a multiple of stripe width.  This can cause performance
+problems by aligning all AGs on the same disk.  To avoid this, run mkfs with
+an AG size that is one stripe unit smaller or larger, for example 8160.
+done
 

Emitting this warning on stderr is silly -- nothing has failed, and we aren't going to abort the format either. Send the warning to stdout.

---
 mkfs/xfs_mkfs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mkfs/xfs_mkfs.c +2 -1
index 6dc0f335..2f2995e1 100644
@@ -3167,11 +3167,12 @@ _("agsize rounded to %lld, sunit = %d\n"),
 
 		if (cli_opt_set(&dopts, D_AGCOUNT) ||
 		    cli_opt_set(&dopts, D_AGSIZE)) {
-			fprintf(stderr, _(
+			printf(_(
 "Warning: AG size is a multiple of stripe width.  This can cause performance\n\
 problems by aligning all AGs on the same disk.  To avoid this, run mkfs with\n\
 an AG size that is one stripe unit smaller or larger, for example %llu.\n"),
 				(unsigned long long)cfg->agsize - dsunit);
+			fflush(stdout);
 			goto validate;
 		}
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

I've noticed a fair number of fstests failures when we create a scratch device on a RAID device and the test specifies an explicit AG count or AG size:

var/tmp/fstests/xfs/042.out.bad renamed from tmp/fstests/tests/xfs/042.out +4 -1
@@ -1,5 +1,8 @@
 QA output created by 042
-Make a 96 megabyte filesystem on SCRATCH_DEV and mount... done
+Make a 96 megabyte filesystem on SCRATCH_DEV and mount... Warning: AG size is a multiple of stripe width.  This can cause performance
+problems by aligning all AGs on the same disk.  To avoid this, run mkfs with
+an AG size that is one stripe unit smaller or larger, for example 8160.
+done
 
Quoted 2 lines

Emitting this warning on stderr is silly -- nothing has failed, and we aren't going to abort the format either. Send the warning to stdout.

I agree with it, looks better printing it out to stdout other than stderr, so, with one caveat below:

I think this might impact user tools monitoring stderr, but for mkfs I don't think it's a big deal, just wanted to raise this concern.

Quoted 24 lines
---
 mkfs/xfs_mkfs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mkfs/xfs_mkfs.c +2 -1
index 6dc0f335..2f2995e1 100644
@@ -3167,11 +3167,12 @@ _("agsize rounded to %lld, sunit = %d\n"),
 
 		if (cli_opt_set(&dopts, D_AGCOUNT) ||
 		    cli_opt_set(&dopts, D_AGSIZE)) {
-			fprintf(stderr, _(
+			printf(_(
 "Warning: AG size is a multiple of stripe width.  This can cause performance\n\
 problems by aligning all AGs on the same disk.  To avoid this, run mkfs with\n\
 an AG size that is one stripe unit smaller or larger, for example %llu.\n"),
 				(unsigned long long)cfg->agsize - dsunit);
+			fflush(stdout);
 			goto validate;
 		}
 
Signature · 1 line
Carlos Maiolino