From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> 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@xxxxxxxxxx> --- scrub/phase6.c | 16 +++++----------- scrub/read_verify.c | 26 +++++++++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/scrub/phase6.c b/scrub/phase6.c index f6274a49..8063d6ce 100644 --- a/scrub/phase6.c +++ b/scrub/phase6.c @@ -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; diff --git a/scrub/read_verify.c b/scrub/read_verify.c index 980b92b8..73d30817 100644 --- a/scrub/read_verify.c +++ b/scrub/read_verify.c @@ -282,22 +282,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? */