From: Darrick J. Wong Date: Wed, 24 Jun 2026 18:16:51 +0000 (-0700) Subject: xfs_scrub: account for reflinked realtime file data X-Git-Tag: v7.1.0~29 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=baef30aabbd5d3fd3183a507ddb466b7b3dc3e5f;p=xfsprogs-dev.git xfs_scrub: account for reflinked realtime file data 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" Reviewed-by: Christoph Hellwig --- diff --git a/scrub/phase7.c b/scrub/phase7.c index 4a25c521..375ba063 100644 --- a/scrub/phase7.c +++ b/scrub/phase7.c @@ -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; }