@@ -3931,6 +3931,9 @@ void bdrv_iostatus_reset(BlockDriverState *bs)
{
if (bdrv_iostatus_is_enabled(bs)) {
bs->iostatus = BLOCK_DEVICE_IO_STATUS_OK;
+ if (bs->job) {
+ block_job_iostatus_reset(bs->job);
+ }
}
}
@@ -139,6 +139,13 @@ bool block_job_is_cancelled(BlockJob *job)
return job->cancelled;
}
+void block_job_iostatus_reset(BlockJob *job)
+{
+ if (job->job_type->iostatus_reset) {
+ job->job_type->iostatus_reset(job);
+ }
+}
+
struct BlockCancelData {
BlockJob *job;
BlockDriverCompletionFunc *cb;
@@ -42,6 +42,9 @@ typedef struct BlockJobType {
/** Optional callback for job types that support setting a speed limit */
void (*set_speed)(BlockJob *job, int64_t speed, Error **errp);
+ /** Optional callback for job types that need to forward I/O status reset */
+ void (*iostatus_reset)(BlockJob *job);
+
/**
* Optional callback for job types that can fill the target member
* of BlockJobInfo.
@@ -257,6 +260,15 @@ bool block_job_is_paused(BlockJob *job);
int block_job_cancel_sync(BlockJob *job);
/**
+ * block_job_iostatus_reset:
+ * @job: The job whose I/O status should be reset.
+ *
+ * Reset I/O status on BlockDriverState objects used by @job, other
+ * than job->bs.
+ */
+void block_job_iostatus_reset(BlockJob *job);
+
+/**
* block_job_error_action:
* @job: The job to signal an error for.
* @bs: The block device on which to set an I/O error.
This will be needed for mirroring, where the source and target have different iostatuses. The source iostatus is reported normally in "query-block", while the target iostatus is accessible via "query-block-jobs". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- block.c | 3 +++ blockjob.c | 7 +++++++ blockjob.h | 12 ++++++++++++ 3 files changed, 22 insertions(+)