diff mbox series

[4/4] xfs_scrub: batch inumbers calls during fscounters calculation

Message ID 156774097106.2644581.12925257167258478461.stgit@magnolia (mailing list archive)
State Superseded
Headers show
Series xfsprogs: bulkstat v5 | expand

Commit Message

Darrick J. Wong Sept. 6, 2019, 3:36 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Improve the efficiency of the phase 7 inode counts by batching requests,
now that we have per-AG inumbers wrappers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 scrub/fscounters.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Dave Chinner Sept. 12, 2019, 11:56 p.m. UTC | #1
On Thu, Sep 05, 2019 at 08:36:11PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Improve the efficiency of the phase 7 inode counts by batching requests,
> now that we have per-AG inumbers wrappers.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Makes sense.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
diff mbox series

Patch

diff --git a/scrub/fscounters.c b/scrub/fscounters.c
index a2cf8171..ad467e0c 100644
--- a/scrub/fscounters.c
+++ b/scrub/fscounters.c
@@ -43,9 +43,10 @@  xfs_count_inodes_ag(
 {
 	struct xfs_inumbers_req	*ireq;
 	uint64_t		nr = 0;
+	unsigned int		i;
 	int			error;
 
-	ireq = xfrog_inumbers_alloc_req(1, 0);
+	ireq = xfrog_inumbers_alloc_req(64, 0);
 	if (!ireq) {
 		str_info(ctx, descr, _("Insufficient memory; giving up."));
 		return false;
@@ -55,7 +56,8 @@  xfs_count_inodes_ag(
 	while (!(error = xfrog_inumbers(&ctx->mnt, ireq))) {
 		if (ireq->hdr.ocount == 0)
 			break;
-		nr += ireq->inumbers[0].xi_alloccount;
+		for (i = 0; i < ireq->hdr.ocount; i++)
+			nr += ireq->inumbers[i].xi_alloccount;
 	}
 
 	free(ireq);