Patchwork [v2,30/45] iostatus: forward block_job_iostatus_reset to block job

login
register
mail settings
Submitter Paolo Bonzini
Date Sept. 26, 2012, 3:56 p.m.
Message ID <1348675011-8794-31-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/187145/
State New
Headers show

Comments

Paolo Bonzini - Sept. 26, 2012, 3:56 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block.c    | 3 +++
 blockjob.c | 3 +++
 blockjob.h | 6 +++++-
 3 file modificati, 11 inserzioni(+). 1 rimozione(-)

Patch

diff --git a/block.c b/block.c
index 074325d..0f57ec1 100644
--- a/block.c
+++ b/block.c
@@ -4162,6 +4162,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);
+        }
     }
 }
 
diff --git a/blockjob.c b/blockjob.c
index 8d2687c..52d290b 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -142,6 +142,9 @@  bool block_job_is_cancelled(BlockJob *job)
 void block_job_iostatus_reset(BlockJob *job)
 {
     job->iostatus = BLOCK_DEVICE_IO_STATUS_OK;
+    if (job->job_type->iostatus_reset) {
+        job->job_type->iostatus_reset(job);
+    }
 }
 
 struct BlockCancelData {
diff --git a/blockjob.h b/blockjob.h
index be37cc1..32bd793 100644
--- a/blockjob.h
+++ b/blockjob.h
@@ -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 whose completion must be triggered
      * manually.
@@ -254,7 +257,8 @@  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 @job.
+ * Reset I/O status on @job and on BlockDriverState objects it uses,
+ * other than job->bs.
  */
 void block_job_iostatus_reset(BlockJob *job);