]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_repair: repair rtbitmap and rtsummary block headers
authorDarrick J. Wong <djwong@kernel.org>
Mon, 5 Aug 2024 19:39:32 +0000 (12:39 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 6 Aug 2024 12:53:50 +0000 (05:53 -0700)
Check and repair the new block headers attached to rtbitmap and
rtsummary blocks.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
repair/rt.c

index 5b939af5241278bdbdb72e36b449d62dce174209..911457bc6f7589cd17c77f2d5787659e857a1af6 100644 (file)
@@ -239,6 +239,7 @@ check_rtfile_contents(
        while (bno < filelen)  {
                struct xfs_bmbt_irec    map;
                struct xfs_buf          *bp;
+               unsigned int            offset = 0;
                int                     nmap = 1;
 
                error = -libxfs_bmapi_read(ip, bno, 1, &map, &nmap, 0);
@@ -264,7 +265,19 @@ check_rtfile_contents(
                        break;
                }
 
-               check_rtwords(rtg, filename, bno, bp->b_addr, buf);
+               if (xfs_has_rtgroups(mp)) {
+                       struct xfs_rtbuf_blkinfo        *hdr = bp->b_addr;
+
+                       if (hdr->rt_owner != cpu_to_be64(ip->i_ino)) {
+                               do_warn(
+ _("corrupt owner in %s at dblock 0x%llx\n"),
+                                       filename, (unsigned long long)bno);
+                       }
+
+                       offset = sizeof(*hdr);
+               }
+
+               check_rtwords(rtg, filename, bno, bp->b_addr + offset, buf);
 
                buf += mp->m_blockwsize << XFS_WORDLOG;
                bno++;