xfs: Don't keep silent if sunit/swidth can not be changed via mount
PATCH v2 2/2 xfs: Don't keep silent if sunit/swidth can not be changed via mount
From: Jie Liu <[email protected]>
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=0The 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.
# 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
# dmesg|tail
.......
XFS (sdb1): can not change alignment: superblock does not support data
alignment--- fs/xfs/xfs_mount.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/xfs/xfs_mount.c +4 -0
@@ -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)) {
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 51 lines · Jeff Liu
From: Jie Liu <[email protected]>
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_infooutput.# 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=0The 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.
# 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 # dmesg|tail ....... XFS (sdb1): can not change alignment: superblock does not support data alignmentSigned-off-by Jie Liu <[email protected]>Cc Mark Tinguely <[email protected]>Cc Dave Chinner <[email protected]>--- fs/xfs/xfs_mount.c | 4 ++++ 1 file changed, 4 insertions(+)fs/xfs/xfs_mount.c +0
-0
fs/xfs/xfs_mount.c xfs_update_alignment(xfs_mount_t *mp) · line 914
Quoted 6 lines
fs/xfs/xfs_mount.c +3
-0@@ -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" );
Same comment again about single line format strings. Otherwise it's ok.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 47 lines · Dave Chinner
Quoted 46 lines · Jeff Liu
From: Jie Liu <[email protected]>
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_infooutput.# 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=0The 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.
# 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 # dmesg|tail ....... XFS (sdb1): can not change alignment: superblock does not support data alignmentSigned-off-by Jie Liu <[email protected]>Cc Mark Tinguely <[email protected]>Cc Dave Chinner <[email protected]>--- fs/xfs/xfs_mount.c | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 14 lines
fs/xfs/xfs_mount.c xfs_update_alignment(xfs_mount_t *mp) · line 914
Quoted 11 lines
fs/xfs/xfs_mount.c +3
-0@@ -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" );Same comment again about single line format strings. Otherwise it's ok.
Ah, sorry! I misunderstood the comments of Mark before. I was bluffed into believing that I should cut the length of log string as short as possible. :(
It will be fixed so.
Thanks,
-Jeff
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 16 lines · Jeff Liu
Quoted 15 lines · Dave Chinner
fs/xfs/xfs_mount.c xfs_update_alignment(xfs_mount_t *mp) · line 914
Quoted 11 lines · Jeff Liu
fs/xfs/xfs_mount.c +3
-0@@ -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" );Same comment again about single line format strings. Otherwise it's ok.
Quoted 3 lines
Ah, sorry! I misunderstood the comments of Mark before. I was bluffed into believing that I should cut the length of log string as short as possible. :(
Thing of being able cut-n-paste the error message out of the log and then being able to grep the source tree for it. i.e.
$ git grep "cannot change alignment: superblock does not support data alignment"
Will fail to find anything in the former case, but in the single line case it will identify the file the error lies in immediately. So the question I always ask myself is "is that format string easy to find with grep?" :)
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 24 lines · Dave Chinner
Quoted 16 lines · Jeff Liu
Quoted 15 lines · Dave Chinner
fs/xfs/xfs_mount.c xfs_update_alignment(xfs_mount_t *mp) · line 914
Quoted 11 lines · Jeff Liu
fs/xfs/xfs_mount.c +3
-0@@ -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" );Same comment again about single line format strings. Otherwise it's ok.
Quoted 3 lines
Ah, sorry! I misunderstood the comments of Mark before. I was bluffed into believing that I should cut the length of log string as short as possible. :(
Thing of being able cut-n-paste the error message out of the log and then being able to grep the source tree for it. i.e.
Quoted 6 lines
$ git grep "cannot change alignment: superblock does not support data alignment"Will fail to find anything in the former case, but in the single line case it will identify the file the error lies in immediately. So the question I always ask myself is "is that format string easy to find with grep?" :)
I just checked your response because of my email box was broken this afternoon.
Thanks for the teaching, I'll bear it in mind. :)
Cheers,
-Jeff
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs