]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_scrub: account for reflinked realtime file data
authorDarrick J. Wong <djwong@kernel.org>
Wed, 24 Jun 2026 18:16:51 +0000 (11:16 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Thu, 25 Jun 2026 13:42:53 +0000 (15:42 +0200)
When we added reflink to the rt device, we forgot to account for
multiply owned space in the phase 7 accounting.  Luckily, Codex noticed
for us.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/phase7.c

index 4a25c521fa0c76aa1c1abb2000a25268b2bfebd2..375ba0632c353b3b2d9b9918bd11f96a273fbf30 100644 (file)
@@ -27,7 +27,8 @@ struct summary_counts {
        unsigned long long      dbytes;         /* data dev bytes */
        unsigned long long      rbytes;         /* rt dev bytes */
        unsigned long long      lbytes;         /* log dev bytes */
-       unsigned long long      next_phys;      /* next phys bytes we see? */
+       unsigned long long      next_dphys;     /* next phys bytes we see on data dev? */
+       unsigned long long      next_rphys;     /* next phys bytes we see on rt dev? */
        unsigned long long      agbytes;        /* freespace bytes */
 
        /* Free space histogram, in fsb */
@@ -120,16 +121,21 @@ count_block_summary(
                break;
        case XFS_DEV_RT:
                /* Count realtime extents. */
+               if (counts->next_rphys >= fsmap->fmr_physical + len)
+                       return 0;
+               else if (counts->next_rphys > fsmap->fmr_physical)
+                       len -= counts->next_rphys - fsmap->fmr_physical;
                counts->rbytes += len;
+               counts->next_rphys = fsmap->fmr_physical + fsmap->fmr_length;
                break;
        case XFS_DEV_DATA:
                /* Count datadev extents. */
-               if (counts->next_phys >= fsmap->fmr_physical + len)
+               if (counts->next_dphys >= fsmap->fmr_physical + len)
                        return 0;
-               else if (counts->next_phys > fsmap->fmr_physical)
-                       len -= counts->next_phys - fsmap->fmr_physical;
+               else if (counts->next_dphys > fsmap->fmr_physical)
+                       len -= counts->next_dphys - fsmap->fmr_physical;
                counts->dbytes += len;
-               counts->next_phys = fsmap->fmr_physical + fsmap->fmr_length;
+               counts->next_dphys = fsmap->fmr_physical + fsmap->fmr_length;
                break;
        }