public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 2/2] xfs: Don't keep silent if sunit/swidth can not be changed via mount
@ 2013-05-02 11:27 Jeff Liu
  2013-05-02 15:28 ` Mark Tinguely
  2013-06-17 22:49 ` Ben Myers
  0 siblings, 2 replies; 3+ messages in thread
From: Jeff Liu @ 2013-05-02 11:27 UTC (permalink / raw)
  To: xfs@oss.sgi.com; +Cc: Mark Tinguely, Dave Chinner

From: Jie Liu <jeff.liu@oracle.com>

As per the mount man page, sunit and swidth can be changed via
mount options.  For XFS, on the face of it, those options seems
works if the specified alignments is properly, e.g.
# mount -o sunit=4096,swidth=8192 /dev/sdb1 /mnt
# mount | grep sdb1
/dev/sdb1 on /mnt type xfs (rw,sunit=4096,swidth=8192)

However, neither sunit nor swidth is shown from the xfs_info output.
# xfs_info /mnt
meta-data=/dev/sdb1    isize=256    agcount=4, agsize=262144 blks
         =             sectsz=512   attr=2
data     =             bsize=4096   blocks=1048576, imaxpct=25
         =             sunit=0      swidth=0 blks
		       ^^^^^^^^^^^^^^^^^^^^^^^^^^
naming   =version 2    bsize=4096   ascii-ci=0
log      =internal     bsize=4096   blocks=2560, version=2
         =             sectsz=512   sunit=0 blks, lazy-count=1
realtime =none         extsz=4096   blocks=0, rtextents=0

The reason is that the alignment can only be changed if the relevant
super block is already configured with alignments, otherwise, the
given value is silently ignored.

With this fix, the attempt to mount a storage without strip alignment
setup on a super block will get an error with a warning in syslog to
indicate the true cause, e.g.
# mount -o sunit=4096,swidth=8192 /dev/sdb1 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
	dmesg | tail  or so
.......
XFS (sdb1): cannot change alignment: superblock does not support data
alignment

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Cc: Mark Tinguely <tinguely@sgi.com>
Cc: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_mount.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 95bd4b5..d243ab7 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -909,6 +909,10 @@ xfs_update_alignment(xfs_mount_t *mp)
 				sbp->sb_width = mp->m_swidth;
 				mp->m_update_flags |= XFS_SB_WIDTH;
 			}
+		} else {
+			xfs_warn(mp,
+	"cannot change alignment: superblock does not support data alignment");
+			return XFS_ERROR(EINVAL);
 		}
 	} else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN &&
 		    xfs_sb_version_hasdalign(&mp->m_sb)) {
-- 
1.7.9.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH v3 2/2] xfs: Don't keep silent if sunit/swidth can not be changed via mount
  2013-05-02 11:27 [PATCH v3 2/2] xfs: Don't keep silent if sunit/swidth can not be changed via mount Jeff Liu
@ 2013-05-02 15:28 ` Mark Tinguely
  2013-06-17 22:49 ` Ben Myers
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Tinguely @ 2013-05-02 15:28 UTC (permalink / raw)
  To: Jeff Liu; +Cc: xfs@oss.sgi.com

On 05/02/13 06:27, Jeff Liu wrote:
> From: Jie Liu<jeff.liu@oracle.com>
>
> As per the mount man page, sunit and swidth can be changed via
> mount options.  For XFS, on the face of it, those options seems
> works if the specified alignments is properly, e.g.
> # mount -o sunit=4096,swidth=8192 /dev/sdb1 /mnt
> # mount | grep sdb1
> /dev/sdb1 on /mnt type xfs (rw,sunit=4096,swidth=8192)
>
> However, neither sunit nor swidth is shown from the xfs_info output.
> # xfs_info /mnt
> meta-data=/dev/sdb1    isize=256    agcount=4, agsize=262144 blks
>           =             sectsz=512   attr=2
> data     =             bsize=4096   blocks=1048576, imaxpct=25
>           =             sunit=0      swidth=0 blks
> 		       ^^^^^^^^^^^^^^^^^^^^^^^^^^
> naming   =version 2    bsize=4096   ascii-ci=0
> log      =internal     bsize=4096   blocks=2560, version=2
>           =             sectsz=512   sunit=0 blks, lazy-count=1
> realtime =none         extsz=4096   blocks=0, rtextents=0
>
> The reason is that the alignment can only be changed if the relevant
> super block is already configured with alignments, otherwise, the
> given value is silently ignored.
>
> With this fix, the attempt to mount a storage without strip alignment
> setup on a super block will get an error with a warning in syslog to
> indicate the true cause, e.g.
> # mount -o sunit=4096,swidth=8192 /dev/sdb1 /mnt
> mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
>         missing codepage or helper program, or other error
>         In some cases useful info is found in syslog - try
> 	dmesg | tail  or so
> .......
> XFS (sdb1): cannot change alignment: superblock does not support data
> alignment
>
> Signed-off-by: Jie Liu<jeff.liu@oracle.com>

Looks good.

Reviewed-by: Mark Tinguely <tinguely@sgi.com>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH v3 2/2] xfs: Don't keep silent if sunit/swidth can not be changed via mount
  2013-05-02 11:27 [PATCH v3 2/2] xfs: Don't keep silent if sunit/swidth can not be changed via mount Jeff Liu
  2013-05-02 15:28 ` Mark Tinguely
@ 2013-06-17 22:49 ` Ben Myers
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Myers @ 2013-06-17 22:49 UTC (permalink / raw)
  To: Jeff Liu; +Cc: Dave Chinner, Mark Tinguely, xfs@oss.sgi.com

On Thu, May 02, 2013 at 07:27:53PM +0800, Jeff Liu wrote:
> From: Jie Liu <jeff.liu@oracle.com>
> 
> As per the mount man page, sunit and swidth can be changed via
> mount options.  For XFS, on the face of it, those options seems
> works if the specified alignments is properly, e.g.
> # mount -o sunit=4096,swidth=8192 /dev/sdb1 /mnt
> # mount | grep sdb1
> /dev/sdb1 on /mnt type xfs (rw,sunit=4096,swidth=8192)
> 
> However, neither sunit nor swidth is shown from the xfs_info output.
> # xfs_info /mnt
> meta-data=/dev/sdb1    isize=256    agcount=4, agsize=262144 blks
>          =             sectsz=512   attr=2
> data     =             bsize=4096   blocks=1048576, imaxpct=25
>          =             sunit=0      swidth=0 blks
> 		       ^^^^^^^^^^^^^^^^^^^^^^^^^^
> naming   =version 2    bsize=4096   ascii-ci=0
> log      =internal     bsize=4096   blocks=2560, version=2
>          =             sectsz=512   sunit=0 blks, lazy-count=1
> realtime =none         extsz=4096   blocks=0, rtextents=0
> 
> The reason is that the alignment can only be changed if the relevant
> super block is already configured with alignments, otherwise, the
> given value is silently ignored.
> 
> With this fix, the attempt to mount a storage without strip alignment
> setup on a super block will get an error with a warning in syslog to
> indicate the true cause, e.g.
> # mount -o sunit=4096,swidth=8192 /dev/sdb1 /mnt
> mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
>        missing codepage or helper program, or other error
>        In some cases useful info is found in syslog - try
> 	dmesg | tail  or so
> .......
> XFS (sdb1): cannot change alignment: superblock does not support data
> alignment
> 
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
> Cc: Mark Tinguely <tinguely@sgi.com>
> Cc: Dave Chinner <dchinner@redhat.com>

Applied.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2013-06-17 22:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-02 11:27 [PATCH v3 2/2] xfs: Don't keep silent if sunit/swidth can not be changed via mount Jeff Liu
2013-05-02 15:28 ` Mark Tinguely
2013-06-17 22:49 ` Ben Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox