From: Darrick J. Wong Date: Thu, 16 Feb 2023 21:52:58 +0000 (-0800) Subject: xfs_scrub: fix broken realtime free blocks unit conversions X-Git-Tag: origin/for-next_2023-03-01~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=085fce0ba2e7222e943b1c756c03de84639361b8;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: fix broken realtime free blocks unit conversions r_blocks is in units of fs blocks, but freertx is in units of realtime extents. Add the missing conversion factor so we don't end up with bogus things like this: Pretend that sda and sdb are both 100T volumes. # mkfs.xfs -f /dev/sda -b -r rtdev=/dev/sdb,extsize=2m # mount /dev/sda /mnt -o rtdev=/dev/sdb # xfs_scrub -dTvn /mnt Phase 7: Check summary counters. 3.5TiB data used; 99.8TiB realtime data used; 55 inodes used. 2.0GiB data found; 50.0MiB realtime data found; 55 inodes found. 55 inodes counted; 0 inodes checked. We just created the filesystem, the realtime volume should be empty. Signed-off-by: Darrick J. Wong Reviewed-by: Carlos Maiolino Signed-off-by: Carlos Maiolino --- diff --git a/scrub/fscounters.c b/scrub/fscounters.c index f21b24e09..3ceae3715 100644 --- a/scrub/fscounters.c +++ b/scrub/fscounters.c @@ -138,7 +138,7 @@ scrub_scan_estimate_blocks( *d_blocks = ctx->mnt.fsgeom.datablocks; *d_bfree = fc.freedata; *r_blocks = ctx->mnt.fsgeom.rtblocks; - *r_bfree = fc.freertx; + *r_bfree = fc.freertx * ctx->mnt.fsgeom.rtextsize; *f_files_used = fc.allocino - fc.freeino; return 0;