]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: return early from bulkstat_for_inumbers if no bulkstat data
authorDarrick J. Wong <djwong@kernel.org>
Mon, 24 Feb 2025 18:21:43 +0000 (10:21 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 25 Feb 2025 17:15:57 +0000 (09:15 -0800)
If bulkstat doesn't return an error code or any bulkstat records, we've
hit the end of the filesystem, so return early.  This can happen if the
inumbers data came from the very last inobt record in the filesystem and
every inode in that inobt record is freed immediately after INUMBERS.
There's no bug here, it's just a minor optimization.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/inodes.c

index 4d3ec07b2d98620c2d04d822d2be6df2a5907733..3b9026ce8fa2f4811a1c16b077306f499d755878 100644 (file)
@@ -65,7 +65,9 @@ bulkstat_for_inumbers(
 
        /* First we try regular bulkstat, for speed. */
        breq->hdr.ino = inumbers->xi_startino;
-       xfrog_bulkstat(&ctx->mnt, breq);
+       error = -xfrog_bulkstat(&ctx->mnt, breq);
+       if (!error && !breq->hdr.ocount)
+               return;
 
        /*
         * Bulkstat might return inodes beyond xi_startino + CHUNKSIZE.  Reduce