Commit 39a45d8463d98ea57347b871641136be64b216a9

Authored by Jie Liu
Committed by Ben Myers
1 parent 2fb8b5027d

xfs: Remove XFS_MOUNT_RETERR

XFS_MOUNT_RETERR is going to be set at xfs_parseargs() if
mp->m_dalign is enabled, so any time we enter "if (mp->m_dalign)"
branch in xfs_update_alignment(), XFS_MOUNT_RETERR is set and so
we always be emitting a warning and returning an error.

Hence, we can remove it and get rid of a couple of redundant
check up against it at xfs_upate_alignment().

Thanks Dave Chinner for the suggestions of simplify the code
in xfs_parseargs().

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>

Showing 3 changed files with 14 additions and 36 deletions Side-by-side Diff

... ... @@ -987,42 +987,27 @@
987 987 */
988 988 if ((BBTOB(mp->m_dalign) & mp->m_blockmask) ||
989 989 (BBTOB(mp->m_swidth) & mp->m_blockmask)) {
990   - if (mp->m_flags & XFS_MOUNT_RETERR) {
991   - xfs_warn(mp, "alignment check failed: "
992   - "(sunit/swidth vs. blocksize)");
993   - return XFS_ERROR(EINVAL);
994   - }
995   - mp->m_dalign = mp->m_swidth = 0;
  990 + xfs_warn(mp,
  991 + "alignment check failed: sunit/swidth vs. blocksize(%d)",
  992 + sbp->sb_blocksize);
  993 + return XFS_ERROR(EINVAL);
996 994 } else {
997 995 /*
998 996 * Convert the stripe unit and width to FSBs.
999 997 */
1000 998 mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign);
1001 999 if (mp->m_dalign && (sbp->sb_agblocks % mp->m_dalign)) {
1002   - if (mp->m_flags & XFS_MOUNT_RETERR) {
1003   - xfs_warn(mp, "alignment check failed: "
1004   - "(sunit/swidth vs. ag size)");
1005   - return XFS_ERROR(EINVAL);
1006   - }
1007 1000 xfs_warn(mp,
1008   - "stripe alignment turned off: sunit(%d)/swidth(%d) "
1009   - "incompatible with agsize(%d)",
1010   - mp->m_dalign, mp->m_swidth,
1011   - sbp->sb_agblocks);
1012   -
1013   - mp->m_dalign = 0;
1014   - mp->m_swidth = 0;
  1001 + "alignment check failed: sunit/swidth vs. agsize(%d)",
  1002 + sbp->sb_agblocks);
  1003 + return XFS_ERROR(EINVAL);
1015 1004 } else if (mp->m_dalign) {
1016 1005 mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
1017 1006 } else {
1018   - if (mp->m_flags & XFS_MOUNT_RETERR) {
1019   - xfs_warn(mp, "alignment check failed: "
1020   - "sunit(%d) less than bsize(%d)",
1021   - mp->m_dalign,
1022   - mp->m_blockmask +1);
1023   - return XFS_ERROR(EINVAL);
1024   - }
1025   - mp->m_swidth = 0;
  1007 + xfs_warn(mp,
  1008 + "alignment check failed: sunit(%d) less than bsize(%d)",
  1009 + mp->m_dalign, sbp->sb_blocksize);
  1010 + return XFS_ERROR(EINVAL);
1026 1011 }
1027 1012 }
1028 1013  
... ... @@ -227,8 +227,6 @@
227 227 operations, typically for
228 228 disk errors in metadata */
229 229 #define XFS_MOUNT_DISCARD (1ULL << 5) /* discard unused blocks */
230   -#define XFS_MOUNT_RETERR (1ULL << 6) /* return alignment errors to
231   - user */
232 230 #define XFS_MOUNT_NOALIGN (1ULL << 7) /* turn off stripe alignment
233 231 allocations */
234 232 #define XFS_MOUNT_ATTR2 (1ULL << 8) /* allow use of attr2 format */
... ... @@ -439,20 +439,15 @@
439 439 }
440 440  
441 441 done:
442   - if (!(mp->m_flags & XFS_MOUNT_NOALIGN)) {
  442 + if (dsunit && !(mp->m_flags & XFS_MOUNT_NOALIGN)) {
443 443 /*
444 444 * At this point the superblock has not been read
445 445 * in, therefore we do not know the block size.
446 446 * Before the mount call ends we will convert
447 447 * these to FSBs.
448 448 */
449   - if (dsunit) {
450   - mp->m_dalign = dsunit;
451   - mp->m_flags |= XFS_MOUNT_RETERR;
452   - }
453   -
454   - if (dswidth)
455   - mp->m_swidth = dswidth;
  449 + mp->m_dalign = dsunit;
  450 + mp->m_swidth = dswidth;
456 451 }
457 452  
458 453 if (mp->m_logbufs != -1 &&