]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: batch inumbers calls during fscounters calculation
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 30 Sep 2019 20:17:07 +0000 (16:17 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Mon, 30 Sep 2019 20:17:07 +0000 (16:17 -0400)
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>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/fscounters.c

index a2cf8171e2b8e0c814483a6e8bd75b58b8c4894c..ad467e0c5c412ac0841639625214e1456cb688ce 100644 (file)
@@ -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);