]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: kill unsupported superblock versions
authorDave Chinner <dchinner@redhat.com>
Wed, 29 Jul 2015 23:23:08 +0000 (09:23 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 29 Jul 2015 23:23:08 +0000 (09:23 +1000)
We don't support filesystems older than dir v2 support, so we
always know about v2 inodes and nlink and other feature bits.
Strip out all the old, unnecessary feature support stuff from
xfs_repair in preparation for merging the 3.16 libxfs code from
the kernel.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
12 files changed:
db/check.c
db/sb.c
repair/agheader.c
repair/dinode.c
repair/globals.h
repair/phase6.c
repair/phase7.c
repair/prefetch.c
repair/sb.c
repair/versions.c
repair/versions.h
repair/xfs_repair.c

index c4c972f21cb5f322a0de9e8fa8c1d09295c900ba..c103a5cdef2a1c19a712876672f6c13b374ecaa5 100644 (file)
@@ -895,13 +895,6 @@ blockget_f(
                                XFS_SB_VERSION_ATTRBIT);
                error++;
        }
-       if ((sbversion & XFS_SB_VERSION_NLINKBIT) &&
-                                       !xfs_sb_version_hasnlink(&mp->m_sb)) {
-               if (!sflag)
-                       dbprintf(_("sb versionnum missing nlink bit %x\n"),
-                               XFS_SB_VERSION_NLINKBIT);
-               error++;
-       }
        if ((sbversion & XFS_SB_VERSION_QUOTABIT) &&
                                        !xfs_sb_version_hasquota(&mp->m_sb)) {
                if (!sflag)
diff --git a/db/sb.c b/db/sb.c
index f0c21456645baedb9ba980e1ff70cd4779d3a480..e9ea2afd821a5cf371d1475d970df9e470274f41 100644 (file)
--- a/db/sb.c
+++ b/db/sb.c
@@ -611,20 +611,25 @@ version_string(
        else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5)
                strcpy(s, "V5");
 
+       /*
+        * We assume the state of these features now, so macros don't exist for
+        * them any more.
+        */
+       if (sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT)
+               strcat(s, ",NLINK");
+       if (sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT)
+               strcat(s, ",SHARED");
+       if (sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT)
+               strcat(s, ",DIRV2");
+
        if (xfs_sb_version_hasattr(sbp))
                strcat(s, ",ATTR");
-       if (xfs_sb_version_hasnlink(sbp))
-               strcat(s, ",NLINK");
        if (xfs_sb_version_hasquota(sbp))
                strcat(s, ",QUOTA");
        if (xfs_sb_version_hasalign(sbp))
                strcat(s, ",ALIGN");
        if (xfs_sb_version_hasdalign(sbp))
                strcat(s, ",DALIGN");
-       if (xfs_sb_version_hasshared(sbp))
-               strcat(s, ",SHARED");
-       if (xfs_sb_version_hasdirv2(sbp))
-               strcat(s, ",DIRV2");
        if (xfs_sb_version_haslogv2(sbp))
                strcat(s, ",LOGV2");
        if (xfs_sb_version_hasextflgbit(sbp))
index 5dbf9922970e324d75af4816c77648e6f6453f79..5902fcd20f78211172c0037b416f712223806bac 100644 (file)
@@ -279,12 +279,9 @@ secondary_sb_wack(
        else if (xfs_sb_version_hassector(sb))
                size = offsetof(xfs_sb_t, sb_logsectsize)
                        + sizeof(sb->sb_logsectsize);
-       else if (xfs_sb_version_hasdirv2(sb))
+       else /* only support dirv2 or more recent */
                size = offsetof(xfs_sb_t, sb_dirblklog)
                        + sizeof(sb->sb_dirblklog);
-       else
-               size = offsetof(xfs_sb_t, sb_width)
-                       + sizeof(sb->sb_width);
 
        /* Check the buffer we read from disk for garbage outside size */
        for (ip = XFS_BUF_PTR(sbuf) + size;
@@ -330,7 +327,7 @@ secondary_sb_wack(
        if (sb->sb_flags)  {
                if (!no_modify)
                        sb->sb_flags = 0;
-               if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero)  {
+               if (!do_bzero)  {
                        rval |= XR_AG_SB;
                        do_warn(_("bad flags field in superblock %d\n"), i);
                } else
@@ -352,7 +349,7 @@ secondary_sb_wack(
        if (sb->sb_inprogress == 1 && sb->sb_uquotino != NULLFSINO)  {
                if (!no_modify)
                        sb->sb_uquotino = 0;
-               if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero)  {
+               if (!do_bzero)  {
                        rval |= XR_AG_SB;
                        do_warn(
                _("non-null user quota inode field in superblock %d\n"),
@@ -367,7 +364,7 @@ secondary_sb_wack(
                        sb->sb_gquotino = 0;
                        dsb->sb_gquotino = 0;
                }
-               if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero)  {
+               if (!do_bzero)  {
                        rval |= XR_AG_SB;
                        do_warn(
                _("non-null group quota inode field in superblock %d\n"),
@@ -388,7 +385,7 @@ secondary_sb_wack(
                        sb->sb_pquotino = 0;
                        dsb->sb_pquotino = 0;
                }
-               if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero)  {
+               if (!do_bzero)  {
                        rval |= XR_AG_SB;
                        do_warn(
                _("non-null project quota inode field in superblock %d\n"),
@@ -401,7 +398,7 @@ secondary_sb_wack(
        if (sb->sb_inprogress == 1 && sb->sb_qflags)  {
                if (!no_modify)
                        sb->sb_qflags = 0;
-               if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero)  {
+               if (!do_bzero)  {
                        rval |= XR_AG_SB;
                        do_warn(_("non-null quota flags in superblock %d\n"),
                                i);
@@ -415,22 +412,10 @@ secondary_sb_wack(
         * written at mkfs time (and the corresponding sb version bits
         * are set).
         */
-       if (!xfs_sb_version_hasshared(sb) && sb->sb_shared_vn != 0)  {
-               if (!no_modify)
-                       sb->sb_shared_vn = 0;
-               if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero)  {
-                       rval |= XR_AG_SB;
-                       do_warn(
-               _("bad shared version number in superblock %d\n"),
-                               i);
-               } else
-                       rval |= XR_AG_SB_SEC;
-       }
-
        if (!xfs_sb_version_hasalign(sb) && sb->sb_inoalignmt != 0)  {
                if (!no_modify)
                        sb->sb_inoalignmt = 0;
-               if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero)  {
+               if (!do_bzero)  {
                        rval |= XR_AG_SB;
                        do_warn(
                _("bad inode alignment field in superblock %d\n"),
@@ -443,7 +428,7 @@ secondary_sb_wack(
            (sb->sb_unit != 0 || sb->sb_width != 0))  {
                if (!no_modify)
                        sb->sb_unit = sb->sb_width = 0;
-               if (sb->sb_versionnum & XR_GOOD_SECSB_VNMASK || !do_bzero)  {
+               if (!do_bzero)  {
                        rval |= XR_AG_SB;
                        do_warn(
                _("bad stripe unit/width fields in superblock %d\n"),
@@ -461,7 +446,7 @@ secondary_sb_wack(
                        sb->sb_logsectsize = 0;
                        sb->sb_logsectlog = 0;
                }
-               if (sb->sb_versionnum & XR_GOOD_SECSB_VNMASK || !do_bzero)  {
+               if (!do_bzero)  {
                        rval |= XR_AG_SB;
                        do_warn(
                _("bad log/data device sector size fields in superblock %d\n"),
index 035212cfeefe6e98292b6ddd1740c9b278717ea7..c9d467b9ae312f44891ae8c30fbac06b63072c29 100644 (file)
@@ -129,13 +129,12 @@ clear_dinode_core(struct xfs_mount *mp, xfs_dinode_t *dinoc, xfs_ino_t ino_num)
                dinoc->di_magic = cpu_to_be16(XFS_DINODE_MAGIC);
        }
 
-       if (!XFS_DINODE_GOOD_VERSION(dinoc->di_version) ||
-           (!fs_inode_nlink && dinoc->di_version > 1))  {
+       if (!XFS_DINODE_GOOD_VERSION(dinoc->di_version)) {
                __dirty_no_modify_ret(dirty);
                if (xfs_sb_version_hascrc(&mp->m_sb))
                        dinoc->di_version = 3;
                else
-                       dinoc->di_version = (fs_inode_nlink) ? 2 : 1;
+                       dinoc->di_version = 2;
        }
 
        if (be16_to_cpu(dinoc->di_mode) != 0)  {
@@ -2137,86 +2136,11 @@ process_check_inode_nlink_version(
 {
        int             dirty = 0;
 
-       if (dino->di_version > 1 && !fs_inode_nlink)  {
-               /*
-                * do we have a fs/inode version mismatch with a valid
-                * version 2 inode here that has to stay version 2 or
-                * lose links?
-                */
-               if (be32_to_cpu(dino->di_nlink) > XFS_MAXLINK_1)  {
-                       /*
-                        * yes.  are nlink inodes allowed?
-                        */
-                       if (fs_inode_nlink_allowed)  {
-                               /*
-                                * yes, update status variable which will
-                                * cause sb to be updated later.
-                                */
-                               fs_inode_nlink = 1;
-                               do_warn
-       (_("version 2 inode %" PRIu64 " claims > %u links, "),
-                                       lino, XFS_MAXLINK_1);
-                               if (!no_modify)  {
-                                       do_warn(
-       _("updating superblock version number\n"));
-                               } else  {
-                                       do_warn(
-       _("would update superblock version number\n"));
-                               }
-                       } else  {
-                               /*
-                                * no, have to convert back to onlinks
-                                * even if we lose some links
-                                */
-                               do_warn(
-       _("WARNING:  version 2 inode %" PRIu64 " claims > %u links, "),
-                                       lino, XFS_MAXLINK_1);
-                               if (!no_modify)  {
-                                       do_warn(_("converting back to version 1,\n"
-                                               "this may destroy %d links\n"),
-                                               be32_to_cpu(dino->di_nlink) -
-                                                       XFS_MAXLINK_1);
-
-                                       dino->di_version = 1;
-                                       dino->di_nlink = cpu_to_be32(XFS_MAXLINK_1);
-                                       dino->di_onlink = cpu_to_be16(XFS_MAXLINK_1);
-                                       dirty = 1;
-                               } else  {
-                                       do_warn(_("would convert back to version 1,\n"
-                                               "\tthis might destroy %d links\n"),
-                                               be32_to_cpu(dino->di_nlink) -
-                                                       XFS_MAXLINK_1);
-                               }
-                       }
-               } else  {
-                       /*
-                        * do we have a v2 inode that we could convert back
-                        * to v1 without losing any links?  if we do and
-                        * we have a mismatch between superblock bits and the
-                        * version bit, alter the version bit in this case.
-                        *
-                        * the case where we lost links was handled above.
-                        */
-                       do_warn(_("found version 2 inode %" PRIu64 ", "), lino);
-                       if (!no_modify)  {
-                               do_warn(_("converting back to version 1\n"));
-                               dino->di_version = 1;
-                               dino->di_onlink = cpu_to_be16(
-                                       be32_to_cpu(dino->di_nlink));
-                               dirty = 1;
-                       } else  {
-                               do_warn(_("would convert back to version 1\n"));
-                       }
-               }
-       }
-
        /*
-        * ok, if it's still a version 2 inode, it's going
-        * to stay a version 2 inode.  it should have a zero
+        * if it's a version 2 inode, it should have a zero
         * onlink field, so clear it.
         */
-       if (dino->di_version > 1 &&
-                       dino->di_onlink != 0 && fs_inode_nlink > 0) {
+       if (dino->di_version > 1 && dino->di_onlink != 0) {
                if (!no_modify) {
                        do_warn(
 _("clearing obsolete nlink field in version 2 inode %" PRIu64 ", was %d, now 0\n"),
@@ -2332,7 +2256,6 @@ process_dinode_int(xfs_mount_t *mp,
        }
 
        if (!XFS_DINODE_GOOD_VERSION(dino->di_version) ||
-           (!fs_inode_nlink && dino->di_version > 1) ||
            (xfs_sb_version_hascrc(&mp->m_sb) && dino->di_version < 3) )  {
                retval = 1;
                if (!uncertain)
@@ -2343,8 +2266,7 @@ process_dinode_int(xfs_mount_t *mp,
                        if (!no_modify) {
                                do_warn(_(" resetting version number\n"));
                                dino->di_version =
-                                       xfs_sb_version_hascrc(&mp->m_sb) ? 3 :
-                                       (fs_inode_nlink) ?  2 : 1;
+                                       xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 2;
                                *dirty = 1;
                        } else
                                do_warn(_(" would reset version number\n"));
index f386686999529a979ed72bc429537bb09c9be376..efd1d03b21be0e5083189c6768de725b50e586e8 100644 (file)
 
 #define NUM_AGH_SECTS          4       /* # of components in an ag header */
 
-/*
- * secondary sb mask -- if the secondary sb feature bits has a
- * the partial sb mask bit set, then you depend on the fields
- * in it up to and including sb_inoalignmt but the unused part of the
- * sector may have trash in it.  If the sb has any bits set that are in
- * the good mask, then the entire sb and sector are good (was zero'ed
- * by mkfs).  The third mask is for filesystems made by pre-6.5 campus
- * alpha mkfs's.  Those are rare so we'll check for those under
- * a special option.
- */
-#define XR_PART_SECSB_VNMASK   0x0F80  /* >= XFS_SB_VERSION_ALIGNBIT */
-#define XR_GOOD_SECSB_VNMASK   0x0F00  /* >= XFS_SB_VERSION_DALIGNBIT */
-#define XR_ALPHA_SECSB_VNMASK  0x0180  /* DALIGN|ALIGN bits */
-
 /* global variables for xfs_repair */
 
 /* arguments and argument flag variables */
index 105bce4d32aeb5782ed19db8cd0d6a2cd6410d58..25e49edaf97f1859e0ad92f9bd5f09429331fe98 100644 (file)
@@ -862,8 +862,6 @@ mk_root_dir(xfs_mount_t *mp)
        int             vers;
        int             times;
 
-       ASSERT(xfs_sb_version_hasdirv2(&mp->m_sb));
-
        tp = libxfs_trans_alloc(mp, 0);
        ip = NULL;
 
@@ -879,7 +877,7 @@ mk_root_dir(xfs_mount_t *mp)
        /*
         * take care of the core -- initialization from xfs_ialloc()
         */
-       vers = xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 1;
+       vers = xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 2;
        memset(&ip->i_d, 0, xfs_icdinode_size(vers));
 
        ip->i_d.di_magic = XFS_DINODE_MAGIC;
@@ -946,8 +944,6 @@ mk_orphanage(xfs_mount_t *mp)
        int             nres;
        struct xfs_name xname;
 
-       ASSERT(xfs_sb_version_hasdirv2(&mp->m_sb));
-
        /*
         * check for an existing lost+found first, if it exists, return
         * its inode. Otherwise, we can create it. Bad lost+found inodes
@@ -1092,8 +1088,6 @@ mv_orphanage(
        int                     ino_offset = 0;
        struct xfs_name         xname;
 
-       ASSERT(xfs_sb_version_hasdirv2(&mp->m_sb));
-
        xname.name = fname;
        xname.len = snprintf((char *)fname, sizeof(fname), "%llu",
                                (unsigned long long)ino);
index d3fe95a8887421b12d87e1a0c8433fc698bf05d0..04dd63b76ca5b218ff93403c994399762de577ab 100644 (file)
@@ -43,13 +43,7 @@ set_nlinks(
                do_warn(_("resetting inode %" PRIu64 " nlinks from %u to %u\n"),
                        ino, dinoc->di_nlink, nrefs);
 
-               if (dinoc->di_version == 1 && nrefs > XFS_MAXLINK_1)  {
-                       ASSERT(fs_inode_nlink);
-                       do_warn(
-_("nlinks %u will overflow v1 ino, ino %" PRIu64 " will be converted to version 2\n"),
-                               nrefs, ino);
-
-               }
+               ASSERT(dinoc->di_version > 1);
                dinoc->di_nlink = nrefs;
        } else  {
                do_warn(
index 7ea0d36fe41e76399e5837f8c8b5db7491cda96e..47bc939168e8c3d21c4353e7d876653bbf4990dc 100644 (file)
@@ -419,8 +419,7 @@ pf_read_inode_dirs(
                if (be16_to_cpu(dino->di_magic) != XFS_DINODE_MAGIC)
                        continue;
 
-               if (!XFS_DINODE_GOOD_VERSION(dino->di_version) ||
-                               (!fs_inode_nlink && dino->di_version > 1))
+               if (!XFS_DINODE_GOOD_VERSION(dino->di_version))
                        continue;
 
                if (be64_to_cpu(dino->di_size) <= XFS_DFORK_DSIZE(dino, mp))
index ce20d0d752475782518236ab9082b2ff015242c9..cb3438e81b029802cbd46dca8242c5f88e57e2b9 100644 (file)
@@ -412,61 +412,6 @@ verify_sb(char *sb_buf, xfs_sb_t *sb, int is_primary_sb)
                        return(XR_BAD_SB_WIDTH);
        }
 
-       /*
-        * if shared bit is set, verify that the version number is sane
-        */
-       if (xfs_sb_version_hasshared(sb))  {
-               if (sb->sb_shared_vn > XFS_SB_MAX_SHARED_VN)
-                       return(XR_BAD_SVN);
-       }
-
-       /*
-        * mkfs's that stamped a feature bit besides the ones in the
-        * mask below could leave garbage in the secondary superblock
-        * sectors.  Anything stamping the shared fs bit or better into
-        * the secondaries is ok and should generate clean secondary
-        * superblock sectors.
-        *
-        * check primary and clean secondary superblocks more strictly
-        */
-       if (is_primary_sb || sb->sb_versionnum & XR_PART_SECSB_VNMASK)  {
-               /*
-                * return errors if shared vn or alignment fields
-                * are set without their feature bits being set
-                */
-               if ((!pre_65_beta && (sb->sb_versionnum & XR_PART_SECSB_VNMASK)) ||
-                   (pre_65_beta && (sb->sb_versionnum & XR_ALPHA_SECSB_VNMASK))) {
-                       /*
-                        * shared version # and inode alignment fields
-                        * should be valid
-                        */
-                       if (sb->sb_shared_vn && !xfs_sb_version_hasshared(sb))
-                               return(XR_BAD_SVN);
-                       if (sb->sb_inoalignmt && !xfs_sb_version_hasalign(sb))
-                               return(XR_BAD_INO_ALIGN);
-               }
-               if ((!pre_65_beta &&
-                    (sb->sb_versionnum & XR_GOOD_SECSB_VNMASK)) ||
-                   (pre_65_beta &&
-                    (sb->sb_versionnum & XFS_SB_VERSION_DALIGNBIT)))  {
-                       /*
-                        * stripe alignment values should be valid
-                        */
-                       if (sb->sb_unit && !xfs_sb_version_hasdalign(sb))
-                               return(XR_BAD_SB_UNIT);
-                       if (sb->sb_width && !xfs_sb_version_hasdalign(sb))
-                               return(XR_BAD_SB_WIDTH);
-               }
-
-#if 0
-               /*
-                * checks involving later superblock fields get added here...
-                */
-               if (sb->sb_versionnum & XR_GOOD_SECSB_VNMASK)  {
-               }
-#endif
-       }
-
        return(XR_OK);
 }
 
@@ -631,58 +576,13 @@ get_sb_geometry(fs_geometry_t *geo, xfs_sb_t *sbp)
        if (xfs_sb_version_hasalign(sbp))
                geo->sb_ialignbit = 1;
 
-       if (xfs_sb_version_hasshared(sbp) ||
-           sbp->sb_versionnum & XR_PART_SECSB_VNMASK)
-               geo->sb_sharedbit = 1;
-
        if (xfs_sb_version_hasdalign(sbp))
                geo->sb_salignbit = 1;
 
        if (xfs_sb_version_hasextflgbit(sbp))
                geo->sb_extflgbit = 1;
 
-       /*
-        * protect against pre-6.5 mkfs-generated garbaged
-        * fields in the secondary superblocks.  pay attention
-        * to those fields if and only if their corresponding
-        * feature bits are set in the feature bits of the
-        * version number or we can deduce from the version bits
-        * that are set that our field was properly initialized
-        * because a field after the field we care about was
-        * properly initialized as well.
-        */
-
-       /*
-        * inode alignment field lives before the data alignment field
-        */
-       if ((!pre_65_beta && (sbp->sb_versionnum & XR_PART_SECSB_VNMASK)) ||
-           (pre_65_beta && (sbp->sb_versionnum & XR_ALPHA_SECSB_VNMASK)))
-               geo->sb_inoalignmt = sbp->sb_inoalignmt;
-
-       if ((!pre_65_beta && (sbp->sb_versionnum & XR_GOOD_SECSB_VNMASK)) ||
-           (pre_65_beta && xfs_sb_version_hasdalign(sbp))) {
-               geo->sb_unit = sbp->sb_unit;
-               geo->sb_width = sbp->sb_width;
-       }
-
-       /*
-        * shared vn always set if either ino or data alignment is on
-        * since that field lives between the quota and inode alignment
-        * fields
-        */
-       if (sbp->sb_versionnum & XR_PART_SECSB_VNMASK)
-               geo->sb_shared_vn = sbp->sb_shared_vn;
-
-       /*
-        * superblock fields located after sb_widthfields get set
-        * into the geometry structure only if we can determine
-        * from the features enabled in this superblock whether
-        * or not the sector was zero'd at mkfs time.
-        */
-       if ((!pre_65_beta && (sbp->sb_versionnum & XR_GOOD_SECSB_VNMASK)) ||
-           (pre_65_beta && (sbp->sb_versionnum & XR_ALPHA_SECSB_VNMASK))) {
-               geo->sb_fully_zeroed = 1;
-       }
+       geo->sb_fully_zeroed = 1;
 }
 
 /*
index 10bcd2963081bf23a42851765d71f52a2657d681..e8c4984a4b7d662e115c3a60ac83c8f27e4048ec 100644 (file)
@@ -28,7 +28,6 @@ void
 update_sb_version(xfs_mount_t *mp)
 {
        xfs_sb_t        *sb;
-       __uint16_t      vn;
 
        sb = &mp->m_sb;
 
@@ -42,10 +41,9 @@ update_sb_version(xfs_mount_t *mp)
                xfs_sb_version_addattr2(sb);
        }
 
-       if (fs_inode_nlink && !xfs_sb_version_hasnlink(sb))  {
-               ASSERT(fs_inode_nlink_allowed);
-               xfs_sb_version_addnlink(sb);
-       }
+       /* V2 inode conversion is now always going to happen */
+       if (!(sb->sb_versionnum & XFS_SB_VERSION_NLINKBIT))
+               sb->sb_versionnum |= XFS_SB_VERSION_NLINKBIT;
 
        /*
         * fix up the superblock version number and feature bits,
@@ -82,14 +80,7 @@ update_sb_version(xfs_mount_t *mp)
 
                if (xfs_sb_version_hasquota(sb))  {
                        lost_quotas = 1;
-                       vn = sb->sb_versionnum;
-                       vn &= ~XFS_SB_VERSION_QUOTABIT;
-
-                       if (!(vn & XFS_SB_VERSION_ALLFBITS))
-                               vn = xfs_sb_version_toold(vn);
-
-                       ASSERT(vn != 0);
-                       sb->sb_versionnum = vn;
+                       sb->sb_versionnum &= ~XFS_SB_VERSION_QUOTABIT;
                }
        }
 
@@ -109,7 +100,7 @@ parse_sb_version(xfs_sb_t *sb)
 
        fs_attributes = 0;
        fs_attributes2 = 0;
-       fs_inode_nlink = 0;
+       fs_inode_nlink = 1;
        fs_quotas = 0;
        fs_aligned_inodes = 0;
        fs_sb_feature_bits = 0;
@@ -120,6 +111,16 @@ parse_sb_version(xfs_sb_t *sb)
        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;
+       }
+
        /*
         * ok, check to make sure that the sb isn't newer
         * than we are
@@ -133,14 +134,6 @@ parse_sb_version(xfs_sb_t *sb)
                }
        }
 
-       if (xfs_sb_version_hasshared(sb))  {
-               fs_shared = 1;
-               if (!fs_shared_allowed)  {
-                       issue_warning = 1;
-                       do_warn(_("This filesystem is marked shared.\n"));
-               }
-       }
-
        if (issue_warning)  {
                do_warn(
 _("This filesystem uses feature(s) not yet supported in this release.\n"
@@ -225,24 +218,11 @@ _("WARNING:  you have disallowed attr2 attributes but this filesystem\n"
                }
        }
 
-       if (xfs_sb_version_hasnlink(sb))  {
-               if (!fs_inode_nlink_allowed)  {
-                       if (!no_modify)  {
-                               do_warn(
-_("WARNING:  you have disallowed version 2 inodes but this filesystem\n"
-  "\thas version 2 inodes.  The filesystem will be downgraded and\n"
-  "\tall version 2 inodes will be converted to version 1 inodes.\n"
-  "\tThis may cause some hard links to files to be destroyed\n"));
-                       } else  {
-                               do_warn(
-_("WARNING:  you have disallowed version 2 inodes but this filesystem\n"
-  "\thas version 2 inodes.  The filesystem would be downgraded and\n"
-  "\tall version 2 inodes would be converted to version 1 inodes.\n"
-  "\tThis might cause some hard links to files to be destroyed\n"));
-                       }
-               } else   {
-                       fs_inode_nlink = 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"
+  "\tversion 2 inode filesystem. If you do not want this, run an older\n"
+  "\tversion of xfs_repair.\n"), no_modify ? "would" : "will");
        }
 
        if (xfs_sb_version_hasquota(sb))  {
index 8e2649a4a62c34db2c3a572ee79c550768d1dfdd..36a5262298093c854cd88ad0eeb39b92014bf10d 100644 (file)
@@ -42,7 +42,6 @@
 
 EXTERN int             fs_attributes_allowed;
 EXTERN int             fs_attributes2_allowed;
-EXTERN int             fs_inode_nlink_allowed;
 EXTERN int             fs_quotas_allowed;
 EXTERN int             fs_aligned_inodes_allowed;
 EXTERN int             fs_sb_feature_bits_allowed;
index 834697a7082b0deccbf3fc1cb87b82ade473996a..d721cd0f6d0ccc2f133e49b8fe8760e81d77a73e 100644 (file)
@@ -199,7 +199,6 @@ process_args(int argc, char **argv)
        sb_width = 0;
        fs_attributes_allowed = 1;
        fs_attributes2_allowed = 1;
-       fs_inode_nlink_allowed = 1;
        fs_quotas_allowed = 1;
        fs_aligned_inodes_allowed = 1;
        fs_sb_feature_bits_allowed = 1;