]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
FOLD: xfs: make sb_metadirino, sb_rgcount and sb_rgblocks separate fields
authorChristoph Hellwig <hch@lst.de>
Thu, 11 Apr 2024 05:12:56 +0000 (07:12 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 12 Apr 2024 05:58:06 +0000 (07:58 +0200)
include/libxfs.h
repair/agheader.c

index b4c6a2882aa3c9bcc4e24fe2f1db502d09690593..a862104cdef56fde677a211da29ac63161eed6bf 100644 (file)
@@ -296,4 +296,16 @@ static inline bool xfs_sb_version_hassparseinodes(struct xfs_sb *sbp)
                xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_SPINODES);
 }
 
+static inline bool xfs_sb_version_hasmetadir(struct xfs_sb *sbp)
+{
+       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
+               xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_METADIR);
+}
+
+static inline bool xfs_sb_version_hasrtgroups(struct xfs_sb *sbp)
+{
+       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
+               xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_RTGROUPS);
+}
+
 #endif /* __LIBXFS_H__ */
index 076860a445156a6b8339f23e4b7940109be844ff..0bc88874a086a113068d96ef778e0aff5e8eda6a 100644 (file)
@@ -357,7 +357,13 @@ secondary_sb_whack(
         *
         * size is the size of data which is valid for this sb.
         */
-       if (xfs_sb_version_hasmetauuid(sb))
+       if (xfs_sb_version_hasrtgroups(sb))
+               size = offsetof(struct xfs_dsb, sb_rgblocks)
+                       + sizeof(sb->sb_rgblocks);
+       else if (xfs_sb_version_hasmetadir(sb))
+               size = offsetof(struct xfs_dsb, sb_metadirino)
+                       + sizeof(sb->sb_metadirino);
+       else if (xfs_sb_version_hasmetauuid(sb))
                size = offsetof(struct xfs_dsb, sb_meta_uuid)
                        + sizeof(sb->sb_meta_uuid);
        else if (xfs_sb_version_hascrc(sb))
@@ -405,15 +411,6 @@ secondary_sb_whack(
                                mp->m_sb.sb_sectsize - size);
                        /* Preserve meta_uuid so we don't fail uuid checks */
                        memcpy(&sb->sb_meta_uuid, &tmpuuid, sizeof(uuid_t));
-
-                       /*
-                        * Preserve the parts of the incore super that extend
-                        * beyond the part that's supposed to match the ondisk
-                        * super byte for byte.
-                        */
-                       sb->sb_metadirino = mp->m_sb.sb_metadirino;
-                       sb->sb_rgblocks = mp->m_sb.sb_rgblocks;
-                       sb->sb_rgcount = mp->m_sb.sb_rgcount;
                } else
                        do_warn(
        _("would zero unused portion of %s superblock (AG #%u)\n"),