All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfsprogs: mkfs: don't default to the physical sector size if it's bigger than XFS_MAX_SECTORSIZE
Date: Tue, 28 Jan 2020 08:14:23 -0800	[thread overview]
Message-ID: <20200128161423.GO3447196@magnolia> (raw)
In-Reply-To: <x49h80ftviy.fsf@segfault.boston.devel.redhat.com>

On Tue, Jan 28, 2020 at 11:07:01AM -0500, 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.

Do we need to check that ft->lsectorsize <= XFS_MAX_SECTORSIZE too?

(Not that I really expect disks with 64k LBA units...)

--D

> 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;
> 

  reply	other threads:[~2020-01-28 16:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20200128161423.GO3447196@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.