]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: only call read_verify_force_io once per pool
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 17 Oct 2019 02:35:26 +0000 (22:35 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 17 Oct 2019 02:35:26 +0000 (22:35 -0400)
There's no reason we need to call read_verify_force_io every AG; we can
just let the request aggregation code do its thing and push when we're
totally done browsing the fsmap information.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/phase6.c
scrub/read_verify.c

index f6274a4998d417f61cb8d4f2e9fd1bd977e3d80c..8063d6ce14ad7a9d3b8701dce769835833d9e2a8 100644 (file)
@@ -411,7 +411,7 @@ xfs_check_rmap(
         */
        if (map->fmr_flags & (FMR_OF_PREALLOC | FMR_OF_ATTR_FORK |
                              FMR_OF_EXTENT_MAP | FMR_OF_SPECIAL_OWNER))
-               goto out;
+               return true;
 
        /* XXX: Filter out directory data blocks. */
 
@@ -423,16 +423,6 @@ xfs_check_rmap(
                return false;
        }
 
-out:
-       /* Is this the last extent?  Fire off the read. */
-       if (map->fmr_flags & FMR_OF_LAST) {
-               ret = read_verify_force_io(rvp);
-               if (ret) {
-                       str_liberror(ctx, ret, descr);
-                       return false;
-               }
-       }
-
        return true;
 }
 
@@ -448,6 +438,10 @@ clean_pool(
        if (!rvp)
                return 0;
 
+       ret = read_verify_force_io(rvp);
+       if (ret)
+               return ret;
+
        ret = read_verify_pool_flush(rvp);
        if (ret)
                goto out_destroy;
index eadeb7e5688e25a87ad36913f0c3ddd251f9953f..9f78b79c5f81c539f7464b4810d0f1751809b309 100644 (file)
@@ -286,22 +286,30 @@ read_verify_schedule_io(
        return 0;
 }
 
+/* Force any per-thread stashed IOs into the verifier. */
+static int
+force_one_io(
+       struct ptvar            *ptv,
+       void                    *data,
+       void                    *foreach_arg)
+{
+       struct read_verify_pool *rvp = foreach_arg;
+       struct read_verify      *rv = data;
+
+       if (rv->io_length == 0)
+               return 0;
+
+       return read_verify_queue(rvp, rv);
+}
+
 /* Force any stashed IOs into the verifier. */
 int
 read_verify_force_io(
        struct read_verify_pool         *rvp)
 {
-       struct read_verify              *rv;
-       int                             ret;
-
        assert(rvp->readbuf);
-       rv = ptvar_get(rvp->rvstate, &ret);
-       if (ret)
-               return ret;
-       if (rv->io_length == 0)
-               return 0;
 
-       return read_verify_queue(rvp, rv);
+       return ptvar_foreach(rvp->rvstate, force_one_io, rvp);
 }
 
 /* How many bytes has this process verified? */