]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - repair/dinode.c
libxfs: refactor manage_zones()
[thirdparty/xfsprogs-dev.git] / repair / dinode.c
index 379f85cf1268e940e9fc00640a2354d80c10c90b..c0a56daa0d64b0c03a2687a6e2ad44b6775eeb5d 100644 (file)
@@ -125,23 +125,16 @@ clear_dinode_core(struct xfs_mount *mp, xfs_dinode_t *dinoc, xfs_ino_t ino_num)
        return;
 }
 
-static int
+static void
 clear_dinode_unlinked(xfs_mount_t *mp, xfs_dinode_t *dino)
 {
 
-       if (be32_to_cpu(dino->di_next_unlinked) != NULLAGINO)  {
-               if (!no_modify)
-                       dino->di_next_unlinked = cpu_to_be32(NULLAGINO);
-               return(1);
-       }
-
-       return(0);
+       dino->di_next_unlinked = cpu_to_be32(NULLAGINO);
 }
 
 /*
  * this clears the unlinked list too so it should not be called
  * until after the agi unlinked lists are walked in phase 3.
- * returns > zero if the inode has been altered while being cleared
  */
 static void
 clear_dinode(xfs_mount_t *mp, xfs_dinode_t *dino, xfs_ino_t ino_num)
@@ -345,21 +338,6 @@ _("inode %" PRIu64 " - bad rt extent overflows - start %" PRIu64 ", "
                return 1;
        }
 
-       /*
-        * verify that the blocks listed in the record
-        * are multiples of an extent
-        */
-       if (xfs_sb_version_hasextflgbit(&mp->m_sb) == 0 &&
-                       (irec->br_startblock % mp->m_sb.sb_rextsize != 0 ||
-                        irec->br_blockcount % mp->m_sb.sb_rextsize != 0)) {
-               do_warn(
-_("malformed rt inode extent [%" PRIu64 " %" PRIu64 "] (fs rtext size = %u)\n"),
-                       irec->br_startblock,
-                       irec->br_blockcount,
-                       mp->m_sb.sb_rextsize);
-               return 1;
-       }
-
        /*
         * set the appropriate number of extents
         * this iterates block by block, this can be optimised using extents
@@ -367,8 +345,7 @@ _("malformed rt inode extent [%" PRIu64 " %" PRIu64 "] (fs rtext size = %u)\n"),
        for (b = irec->br_startblock; b < irec->br_startblock +
                        irec->br_blockcount; b += mp->m_sb.sb_rextsize)  {
                ext = (xfs_rtblock_t) b / mp->m_sb.sb_rextsize;
-               pwe = xfs_sb_version_hasextflgbit(&mp->m_sb) &&
-                               irec->br_state == XFS_EXT_UNWRITTEN &&
+               pwe = irec->br_state == XFS_EXT_UNWRITTEN &&
                                (b % mp->m_sb.sb_rextsize != 0);
 
                if (check_dups == 1)  {
@@ -1199,8 +1176,8 @@ process_quota_inode(
        struct xfs_buf          *bp;
        xfs_filblks_t           dqchunklen;
        uint                    dqperchunk;
-       int                     quota_type;
-       char                    *quota_string;
+       int                     quota_type = 0;
+       char                    *quota_string = NULL;
        xfs_dqid_t              dqid;
        xfs_fileoff_t           qbno;
        int                     i;
@@ -2675,9 +2652,16 @@ _("bad (negative) size %" PRId64 " on inode %" PRIu64 "\n"),
         * we're going to find.  check_dups is set to 1 only during
         * phase 4.  Ugly.
         */
-       if (check_dups && !no_modify) {
-               clear_dinode_unlinked(mp, dino);
-               *dirty += 1;
+       if (check_dups && be32_to_cpu(dino->di_next_unlinked) != NULLAGINO) {
+               if (no_modify) {
+                       do_warn(
+       _("Would clear next_unlinked in inode %" PRIu64 "\n"), lino);
+               } else  {
+                       clear_dinode_unlinked(mp, dino);
+                       do_warn(
+       _("Cleared next_unlinked in inode %" PRIu64 "\n"), lino);
+                       *dirty += 1;
+               }
        }
 
        /* set type and map type info */