On 1/28/20 10:07 AM, Jeff Moyer wrote: > 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@xxxxxxxxxx> Looks fine to me, sorry for the long delay; I think you answered the question about checking the logical sector size (we validate it later on) Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx> > > 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; >