From 085fce0ba2e7222e943b1c756c03de84639361b8 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Thu, 16 Feb 2023 13:52:58 -0800 Subject: [PATCH] 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 --- scrub/fscounters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.39.5