]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: check the rt summary against observations
authorDarrick J. Wong <djwong@kernel.org>
Wed, 13 Jul 2022 22:20:56 +0000 (17:20 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 13 Jul 2022 22:20:56 +0000 (17:20 -0500)
Teach xfs_repair to check the ondisk realtime summary file against its
own observations.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
repair/phase5.c
repair/rt.c
repair/rt.h

index d1ddd22481f8f8533c9e60dbed19558cf77f4a9b..b04912d82f19c36ef1e9eb17969162cfb70ece31 100644 (file)
@@ -609,6 +609,7 @@ check_rtmetadata(
        rtinit(mp);
        generate_rtinfo(mp, btmcompute, sumcompute);
        check_rtbitmap(mp);
+       check_rtsummary(mp);
 }
 
 void
index b964d168a2367b4967a84b048074aa7f70ffa486..a4cca7aa2238097d51f5e1f195ddc149bb28ebcb 100644 (file)
@@ -198,72 +198,13 @@ check_rtbitmap(
                        mp->m_sb.sb_rbmblocks);
 }
 
-#if 0
-/*
- * returns 1 if bad, 0 if good
- */
-int
-check_summary(xfs_mount_t *mp)
-{
-       xfs_rfsblock_t  bno;
-       xfs_suminfo_t   *csp;
-       xfs_suminfo_t   *fsp;
-       int             log;
-       int             error = 0;
-
-       error = 0;
-       csp = sumcompute;
-       fsp = sumfile;
-       for (log = 0; log < mp->m_rsumlevels; log++) {
-               for (bno = 0;
-                    bno < mp->m_sb.sb_rbmblocks;
-                    bno++, csp++, fsp++) {
-                       if (*csp != *fsp) {
-                               do_warn(
-       _("rt summary mismatch, size %d block %llu, file: %d, computed: %d\n"),
-                                               log, bno, *fsp, *csp);
-                               error = 1;
-                       }
-               }
-       }
-
-       return(error);
-}
-
-/*
- * copy the real-time summary file data into memory
- */
 void
-process_rtsummary(
-       xfs_mount_t             *mp,
-       struct xfs_dinode       *dino,
-       blkmap_t                *blkmap)
+check_rtsummary(
+       struct xfs_mount        *mp)
 {
-       xfs_fsblock_t           bno;
-       struct xfs_buf          *bp;
-       char                    *bytes;
-       int                     sumbno;
+       if (need_rsumino)
+               return;
 
-       for (sumbno = 0; sumbno < blkmap->count; sumbno++) {
-               bno = blkmap_get(blkmap, sumbno);
-               if (bno == NULLFSBLOCK) {
-                       do_warn(_("block %d for rtsummary inode is missing\n"),
-                                       sumbno);
-                       error++;
-                       continue;
-               }
-               error = -libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno),
-                               XFS_FSB_TO_BB(mp, 1), 0, NULL, &bp);
-               if (error) {
-                       do_warn(_("can't read block %d for rtsummary inode\n"),
-                                       sumbno);
-                       error++;
-                       continue;
-               }
-               bytes = bp->b_un.b_addr;
-               memmove((char *)sumfile + sumbno * mp->m_sb.sb_blocksize, bytes,
-                       mp->m_sb.sb_blocksize);
-               libxfs_buf_relse(bp);
-       }
+       check_rtfile_contents(mp, "rtsummary", mp->m_sb.sb_rsumino, sumcompute,
+                       XFS_B_TO_FSB(mp, mp->m_rsumsize));
 }
-#endif
index 2023153f65cdf091ed6f93eea75e42c90f5c9e65..be24e91c95ecd3262db9860e04bd9bf808214adf 100644 (file)
@@ -17,15 +17,6 @@ generate_rtinfo(xfs_mount_t  *mp,
                xfs_suminfo_t   *sumcompute);
 
 void check_rtbitmap(struct xfs_mount *mp);
-
-#if 0
-
-int
-check_summary(xfs_mount_t      *mp);
-
-void
-process_rtsummary(xfs_mount_t  *mp,
-               struct blkmap   *blkmap);
-#endif
+void check_rtsummary(struct xfs_mount *mp);
 
 #endif /* _XFS_REPAIR_RT_H_ */