[PATCH] xfs_scrub: don't use statvfs to collect data volume block counts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

The function scrub_scan_estimate_blocks naïvely uses the statvfs counts
to estimate the size and free blocks on the data volume.  Unfortunately,
it fails to account for the fact that statvfs can return the size and
free counts for the realtime volume if the root directory has the
rtinherit flag set, which leads to phase 7 reporting totally absurd
quantities.

The XFS_IOC_FSCOUNTS ioctl returns the size and free block count of both
volumes correctly, so use that instead.

Fixes: 604dd3345f35 ("xfs_scrub: filesystem counter collection functions")
Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 scrub/fscounters.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/scrub/fscounters.c b/scrub/fscounters.c
index f9d64f8c008f..a2ca0b3f018c 100644
--- a/scrub/fscounters.c
+++ b/scrub/fscounters.c
@@ -154,10 +154,8 @@ scrub_scan_estimate_blocks(
 
 	sfs.f_bfree += rb.resblks_avail;
 
-	*d_blocks = sfs.f_blocks;
-	if (ctx->mnt.fsgeom.logstart > 0)
-		*d_blocks += ctx->mnt.fsgeom.logblocks;
-	*d_bfree = sfs.f_bfree;
+	*d_blocks = ctx->mnt.fsgeom.datablocks;
+	*d_bfree = fc.freedata;
 	*r_blocks = ctx->mnt.fsgeom.rtblocks;
 	*r_bfree = fc.freertx;
 	*f_files = sfs.f_files;



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux