]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - repair/versions.c
xfs_repair: test XFS_SB_VERSION_SHAREDBIT only once
[thirdparty/xfsprogs-dev.git] / repair / versions.c
index 0bf4ab3d02904fa347bc1230f1bd9b72671b7350..e96ee5ca566e00b5140ddbc8b69695ca3aa3a9d5 100644 (file)
@@ -16,7 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "xfs/libxfs.h"
+#include "libxfs.h"
 
 #define EXTERN
 #include "versions.h"
@@ -31,15 +31,11 @@ update_sb_version(xfs_mount_t *mp)
 
        sb = &mp->m_sb;
 
-       if (fs_attributes && !xfs_sb_version_hasattr(sb))  {
-               ASSERT(fs_attributes_allowed);
+       if (fs_attributes && !xfs_sb_version_hasattr(sb))
                xfs_sb_version_addattr(sb);
-       }
 
-       if (fs_attributes2 && !xfs_sb_version_hasattr2(sb))  {
-               ASSERT(fs_attributes2_allowed);
+       if (fs_attributes2 && !xfs_sb_version_hasattr2(sb))
                xfs_sb_version_addattr2(sb);
-       }
 
        /* V2 inode conversion is now always going to happen */
        if (!(sb->sb_versionnum & XFS_SB_VERSION_NLINKBIT))
@@ -51,10 +47,8 @@ update_sb_version(xfs_mount_t *mp)
         * have quotas.
         */
        if (fs_quotas)  {
-               if (!xfs_sb_version_hasquota(sb))  {
-                       ASSERT(fs_quotas_allowed);
+               if (!xfs_sb_version_hasquota(sb))
                        xfs_sb_version_addquota(sb);
-               }
 
                /*
                 * protect against stray bits in the quota flag field
@@ -84,7 +78,7 @@ update_sb_version(xfs_mount_t *mp)
                }
        }
 
-       if (!fs_aligned_inodes && xfs_sb_version_hasalign(sb))  
+       if (!fs_aligned_inodes && xfs_sb_version_hasalign(sb))
                sb->sb_versionnum &= ~XFS_SB_VERSION_ALIGNBIT;
 }
 
@@ -96,8 +90,6 @@ update_sb_version(xfs_mount_t *mp)
 int
 parse_sb_version(xfs_sb_t *sb)
 {
-       int issue_warning;
-
        fs_attributes = 0;
        fs_attributes2 = 0;
        fs_inode_nlink = 1;
@@ -109,17 +101,6 @@ parse_sb_version(xfs_sb_t *sb)
        have_uquotino = 0;
        have_gquotino = 0;
        have_pquotino = 0;
-       issue_warning = 0;
-
-       if (sb->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) {
-               do_warn(_("Shared Version bit set. Not supported. Ever.\n"));
-               return 1;
-       }
-
-       if (sb->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) {
-               do_warn(_("Shared Version bit set. Not supported. Ever.\n"));
-               return 1;
-       }
 
        if (sb->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) {
                do_warn(_("Shared Version bit set. Not supported. Ever.\n"));
@@ -130,21 +111,8 @@ parse_sb_version(xfs_sb_t *sb)
         * ok, check to make sure that the sb isn't newer
         * than we are
         */
-       if (xfs_sb_version_hasextflgbit(sb))  {
+       if (xfs_sb_version_hasextflgbit(sb))
                fs_has_extflgbit = 1;
-               if (!fs_has_extflgbit_allowed)  {
-                       issue_warning = 1;
-                       do_warn(
-                       _("This filesystem has uninitialized extent flags.\n"));
-               }
-       }
-
-       if (issue_warning)  {
-               do_warn(
-_("This filesystem uses feature(s) not yet supported in this release.\n"
-  "Please run a more recent version of xfs_repair.\n"));
-               return(1);
-       }
 
        if (!xfs_sb_good_version(sb))  {
                do_warn(_("WARNING:  unknown superblock version %d\n"),
@@ -154,24 +122,8 @@ _("This filesystem contains features not understood by this program.\n"));
                return(1);
        }
 
-       if (XFS_SB_VERSION_NUM(sb) >= XFS_SB_VERSION_4)  {
-               if (!fs_sb_feature_bits_allowed)  {
-                       if (!no_modify)  {
-                               do_warn(
-_("WARNING:  you have disallowed superblock-feature-bits-allowed\n"
-  "\tbut this superblock has feature bits.  The superblock\n"
-  "\twill be downgraded.  This may cause loss of filesystem meta-data\n"));
-                       } else   {
-                               do_warn(
-_("WARNING:  you have disallowed superblock-feature-bits-allowed\n"
-  "\tbut this superblock has feature bits.  The superblock\n"
-  "\twould be downgraded.  This might cause loss of filesystem\n"
-  "\tmeta-data.\n"));
-                       }
-               } else   {
-                       fs_sb_feature_bits = 1;
-               }
-       }
+       if (XFS_SB_VERSION_NUM(sb) >= XFS_SB_VERSION_4)
+               fs_sb_feature_bits = 1;
 
        /* Look for V5 feature flags we don't know about */
        if (XFS_SB_VERSION_NUM(sb) >= XFS_SB_VERSION_5 &&
@@ -187,96 +139,42 @@ _("Superblock has unknown compat/rocompat/incompat features (0x%x/0x%x/0x%x).\n"
                return 1;
        }
 
-       if (xfs_sb_version_hasattr(sb))  {
-               if (!fs_attributes_allowed)  {
-                       if (!no_modify)  {
-                               do_warn(
-_("WARNING:  you have disallowed attributes but this filesystem\n"
-  "\thas attributes.  The filesystem will be downgraded and\n"
-  "\tall attributes will be removed.\n"));
-                       } else  {
-                               do_warn(
-_("WARNING:  you have disallowed attributes but this filesystem\n"
-  "\thas attributes.  The filesystem would be downgraded and\n"
-  "\tall attributes would be removed.\n"));
-                       }
-               } else   {
-                       fs_attributes = 1;
-               }
-       }
+       if (xfs_sb_version_hasattr(sb))
+               fs_attributes = 1;
 
-       if (xfs_sb_version_hasattr2(sb))  {
-               if (!fs_attributes2_allowed)  {
-                       if (!no_modify)  {
-                               do_warn(
-_("WARNING:  you have disallowed attr2 attributes but this filesystem\n"
-  "\thas attributes.  The filesystem will be downgraded and\n"
-  "\tall attr2 attributes will be removed.\n"));
-                       } else  {
-                               do_warn(
-_("WARNING:  you have disallowed attr2 attributes but this filesystem\n"
-  "\thas attributes.  The filesystem would be downgraded and\n"
-  "\tall attr2 attributes would be removed.\n"));
-                       }
-               } else   {
-                       fs_attributes2 = 1;
-               }
-       }
+       if (xfs_sb_version_hasattr2(sb))
+               fs_attributes2 = 1;
 
        if (!(sb->sb_versionnum & XFS_SB_VERSION_NLINKBIT)) {
-               do_warn(
-_("WARNING: you have a V1 inode filesystem. It %s be converted to a\n"
+               if (!no_modify) {
+                       do_warn(
+_("WARNING: you have a V1 inode filesystem. It will be converted to a\n"
+  "\tversion 2 inode filesystem. If you do not want this, run an older\n"
+  "\tversion of xfs_repair.\n"));
+               } else  {
+                       do_warn(
+_("WARNING: you have a V1 inode filesystem. It would be converted to a\n"
   "\tversion 2 inode filesystem. If you do not want this, run an older\n"
-  "\tversion of xfs_repair.\n"), no_modify ? "would" : "will");
+  "\tversion of xfs_repair.\n"));
+               }
        }
 
        if (xfs_sb_version_hasquota(sb))  {
-               if (!fs_quotas_allowed)  {
-                       if (!no_modify)  {
-                               do_warn(
-_("WARNING:  you have disallowed quotas but this filesystem\n"
-  "\thas quotas.  The filesystem will be downgraded and\n"
-  "\tall quota information will be removed.\n"));
-                       } else  {
-                               do_warn(
-_("WARNING:  you have disallowed quotas but this filesystem\n"
-  "\thas quotas.  The filesystem would be downgraded and\n"
-  "\tall quota information would be removed.\n"));
-                       }
-               } else   {
-                       fs_quotas = 1;
+               fs_quotas = 1;
 
-                       if (sb->sb_uquotino != 0 &&
-                                       sb->sb_uquotino != NULLFSINO)
-                               have_uquotino = 1;
+               if (sb->sb_uquotino != 0 && sb->sb_uquotino != NULLFSINO)
+                       have_uquotino = 1;
 
-                       if (sb->sb_gquotino != 0 &&
-                                       sb->sb_gquotino != NULLFSINO)
-                               have_gquotino = 1;
+               if (sb->sb_gquotino != 0 && sb->sb_gquotino != NULLFSINO)
+                       have_gquotino = 1;
 
-                       if (sb->sb_pquotino != 0 &&
-                                       sb->sb_pquotino != NULLFSINO)
-                               have_pquotino = 1;
-               }
+               if (sb->sb_pquotino != 0 && sb->sb_pquotino != NULLFSINO)
+                       have_pquotino = 1;
        }
 
        if (xfs_sb_version_hasalign(sb))  {
-               if (fs_aligned_inodes_allowed)  {
-                       fs_aligned_inodes = 1;
-                       fs_ino_alignment = sb->sb_inoalignmt;
-               } else   {
-                       if (!no_modify)  {
-                               do_warn(
-_("WARNING:  you have disallowed aligned inodes but this filesystem\n"
-  "\thas aligned inodes.  The filesystem will be downgraded.\n"
-  "\tThis will permanently degrade the performance of this filesystem.\n"));
-                       } else  {
-                               do_warn(
-_("WARNING:  you have disallowed aligned inodes but this filesystem\n"
-  "\thas aligned inodes.  The filesystem would be downgraded.\n"
-  "\tThis would permanently degrade the performance of this filesystem.\n"));
-                       }
-               }
+               fs_aligned_inodes = 1;
+               fs_ino_alignment = sb->sb_inoalignmt;
        }
 
        /*