Add a new abort function to the read verify pool code so that the caller
can immediately abort all pending verification work if things start
going wrong. There's no point in waiting for queued work to run if
we've already decided to bail.
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>
out_rtpool:
if (vs.rvp_realtime) {
- read_verify_pool_flush(vs.rvp_realtime);
+ read_verify_pool_abort(vs.rvp_realtime);
read_verify_pool_destroy(vs.rvp_realtime);
}
out_logpool:
if (vs.rvp_log) {
- read_verify_pool_flush(vs.rvp_log);
+ read_verify_pool_abort(vs.rvp_log);
read_verify_pool_destroy(vs.rvp_log);
}
out_datapool:
- read_verify_pool_flush(vs.rvp_data);
+ read_verify_pool_abort(vs.rvp_data);
read_verify_pool_destroy(vs.rvp_data);
out_rbad:
bitmap_free(&vs.r_bad);
return NULL;
}
+/* Abort all verification work. */
+void
+read_verify_pool_abort(
+ struct read_verify_pool *rvp)
+{
+ if (!rvp->runtime_error)
+ rvp->runtime_error = ECANCELED;
+ workqueue_terminate(&rvp->wq);
+}
+
/* Finish up any read verification work. */
void
read_verify_pool_flush(
struct disk *disk, size_t miniosz,
read_verify_ioerr_fn_t ioerr_fn,
unsigned int submitter_threads);
+void read_verify_pool_abort(struct read_verify_pool *rvp);
void read_verify_pool_flush(struct read_verify_pool *rvp);
void read_verify_pool_destroy(struct read_verify_pool *rvp);