xfs: Remove XFS_MOUNT_RETERR
authorJie Liu <jeff.liu@oracle.com>
Thu, 2 May 2013 11:27:47 +0000 (19:27 +0800)
committerBen Myers <bpm@sgi.com>
Wed, 19 Jun 2013 19:54:17 +0000 (14:54 -0500)
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>
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.h
fs/xfs/xfs_super.c

index 6a19434eba2a19134ccba7456c47cbeb49627aaf..2978bb4cc72a7e454b48222090ba7a8b62455bdc 100644 (file)
@@ -987,42 +987,27 @@ xfs_update_alignment(xfs_mount_t *mp)
                 */
                if ((BBTOB(mp->m_dalign) & mp->m_blockmask) ||
                    (BBTOB(mp->m_swidth) & mp->m_blockmask)) {
-                       if (mp->m_flags & XFS_MOUNT_RETERR) {
-                               xfs_warn(mp, "alignment check failed: "
-                                        "(sunit/swidth vs. blocksize)");
-                               return XFS_ERROR(EINVAL);
-                       }
-                       mp->m_dalign = mp->m_swidth = 0;
+                       xfs_warn(mp,
+               "alignment check failed: sunit/swidth vs. blocksize(%d)",
+                               sbp->sb_blocksize);
+                       return XFS_ERROR(EINVAL);
                } else {
                        /*
                         * Convert the stripe unit and width to FSBs.
                         */
                        mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign);
                        if (mp->m_dalign && (sbp->sb_agblocks % mp->m_dalign)) {
-                               if (mp->m_flags & XFS_MOUNT_RETERR) {
-                                       xfs_warn(mp, "alignment check failed: "
-                                                "(sunit/swidth vs. ag size)");
-                                       return XFS_ERROR(EINVAL);
-                               }
                                xfs_warn(mp,
-               "stripe alignment turned off: sunit(%d)/swidth(%d) "
-               "incompatible with agsize(%d)",
-                                       mp->m_dalign, mp->m_swidth,
-                                       sbp->sb_agblocks);
-
-                               mp->m_dalign = 0;
-                               mp->m_swidth = 0;
+                       "alignment check failed: sunit/swidth vs. agsize(%d)",
+                                        sbp->sb_agblocks);
+                               return XFS_ERROR(EINVAL);
                        } else if (mp->m_dalign) {
                                mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
                        } else {
-                               if (mp->m_flags & XFS_MOUNT_RETERR) {
-                                       xfs_warn(mp, "alignment check failed: "
-                                               "sunit(%d) less than bsize(%d)",
-                                               mp->m_dalign,
-                                               mp->m_blockmask +1);
-                                       return XFS_ERROR(EINVAL);
-                               }
-                               mp->m_swidth = 0;
+                               xfs_warn(mp,
+                       "alignment check failed: sunit(%d) less than bsize(%d)",
+                                        mp->m_dalign, sbp->sb_blocksize);
+                               return XFS_ERROR(EINVAL);
                        }
                }
 
index de7abf677abe49b4576350b7b9cef1460f753d55..4e374d4a9189622bccb2b56aa331c7218567d1f2 100644 (file)
@@ -227,8 +227,6 @@ typedef struct xfs_mount {
                                                   operations, typically for
                                                   disk errors in metadata */
 #define XFS_MOUNT_DISCARD      (1ULL << 5)     /* discard unused blocks */
-#define XFS_MOUNT_RETERR       (1ULL << 6)     /* return alignment errors to
-                                                  user */
 #define XFS_MOUNT_NOALIGN      (1ULL << 7)     /* turn off stripe alignment
                                                   allocations */
 #define XFS_MOUNT_ATTR2                (1ULL << 8)     /* allow use of attr2 format */
index 3033ba5e9762f19609a7f86d5117f64eb70f7bd4..14924099bcb8e7d8daff1ae2e4fd95f669529a55 100644 (file)
@@ -439,20 +439,15 @@ xfs_parseargs(
        }
 
 done:
-       if (!(mp->m_flags & XFS_MOUNT_NOALIGN)) {
+       if (dsunit && !(mp->m_flags & XFS_MOUNT_NOALIGN)) {
                /*
                 * At this point the superblock has not been read
                 * in, therefore we do not know the block size.
                 * Before the mount call ends we will convert
                 * these to FSBs.
                 */
-               if (dsunit) {
-                       mp->m_dalign = dsunit;
-                       mp->m_flags |= XFS_MOUNT_RETERR;
-               }
-
-               if (dswidth)
-                       mp->m_swidth = dswidth;
+               mp->m_dalign = dsunit;
+               mp->m_swidth = dswidth;
        }
 
        if (mp->m_logbufs != -1 &&