linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfsprogs: mkfs: don't default to the physical sector size if it's bigger than XFS_MAX_SECTORSIZE
@ 2020-01-28 16:07 Jeff Moyer
  2020-01-28 16:14 ` Darrick J. Wong
  2021-04-16 17:39 ` Eric Sandeen
  0 siblings, 2 replies; 6+ messages in thread
From: Jeff Moyer @ 2020-01-28 16:07 UTC (permalink / raw)
  To: linux-xfs

Hi,

In testing on ppc64, I ran into the following error when making a file
system:

# ./mkfs.xfs -b size=65536 -f /dev/ram0
illegal sector size 65536

Which is odd, because I didn't specify a sector size!  The problem is
that validate_sectorsize defaults to the physical sector size, but in
this case, the physical sector size is bigger than XFS_MAX_SECTORSIZE.

# cat /sys/block/ram0/queue/physical_block_size 
65536

Fall back to the default (logical sector size) if the physical sector
size is greater than XFS_MAX_SECTORSIZE.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 606f79da..dc9858af 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -1803,8 +1803,13 @@ validate_sectorsize(
 		if (!ft->lsectorsize)
 			ft->lsectorsize = XFS_MIN_SECTORSIZE;
 
-		/* Older kernels may not have physical/logical distinction */
-		if (!ft->psectorsize)
+		/*
+		 * Older kernels may not have physical/logical distinction.
+		 * Some architectures have a page size > XFS_MAX_SECTORSIZE.
+		 * In that case, a ramdisk or persistent memory device may
+		 * advertise a physical sector size that is too big to use.
+		 */
+		if (!ft->psectorsize || ft->psectorsize > XFS_MAX_SECTORSIZE)
 			ft->psectorsize = ft->lsectorsize;
 
 		cfg->sectorsize = ft->psectorsize;


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-16 17:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-28 16:07 [PATCH] xfsprogs: mkfs: don't default to the physical sector size if it's bigger than XFS_MAX_SECTORSIZE Jeff Moyer
2020-01-28 16:14 ` Darrick J. Wong
2020-01-28 16:54   ` Jeff Moyer
2020-01-28 23:53     ` Dave Chinner
2020-02-04 18:38   ` Jeff Moyer
2021-04-16 17:39 ` Eric Sandeen

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).