diff mbox series

[2/4] xfs_spaceman: remove open-coded per-ag bulkstat

Message ID 156685488294.2841421.13810601288995238059.stgit@magnolia
State Superseded
Headers show
Series xfsprogs: bulkstat v5 | expand

Commit Message

Darrick J. Wong Aug. 26, 2019, 9:28 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Now that xfrog_bulkstat supports per-AG bulkstat, we can get rid of the
open coded one in spaceman.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 spaceman/health.c |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/spaceman/health.c b/spaceman/health.c
index ff03d074..43b99044 100644
--- a/spaceman/health.c
+++ b/spaceman/health.c
@@ -265,28 +265,22 @@  report_bulkstat_health(
 {
 	struct xfs_bulkstat_req	*breq;
 	char			descr[256];
-	uint64_t		startino = 0;
-	uint64_t		lastino = -1ULL;
 	uint32_t		i;
 	int			error;
 
-	if (agno != NULLAGNUMBER) {
-		startino = xfrog_agino_to_ino(&file->xfd, agno, 0);
-		lastino = xfrog_agino_to_ino(&file->xfd, agno + 1, 0) - 1;
-	}
-
-	breq = xfrog_bulkstat_alloc_req(128, startino);
+	breq = xfrog_bulkstat_alloc_req(128, 0);
 	if (!breq) {
 		perror("bulk alloc req");
 		exitcode = 1;
 		return 1;
 	}
 
+	if (agno != NULLAGNUMBER)
+		xfrog_bulkstat_set_ag(breq, agno);
+
 	while ((error = xfrog_bulkstat(&file->xfd, breq) == 0) &&
 			breq->hdr.ocount > 0) {
 		for (i = 0; i < breq->hdr.ocount; i++) {
-			if (breq->bulkstat[i].bs_ino > lastino)
-				goto out;
 			snprintf(descr, sizeof(descr) - 1, _("inode %"PRIu64),
 					breq->bulkstat[i].bs_ino);
 			report_sick(descr, inode_flags,
@@ -294,7 +288,7 @@  report_bulkstat_health(
 					breq->bulkstat[i].bs_checked);
 		}
 	}
-out:
+
 	free(breq);
 	return error;
 }