[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH RFC 31/51] qemu: blockjob: Convert qemuBlockJobSyncEndDisk to take job instead of disk



And rename it in accordance with the change.

Signed-off-by: Peter Krempa <pkrempa redhat com>
---
 src/qemu/qemu_blockjob.c  | 20 ++++++++++----------
 src/qemu/qemu_blockjob.h  |  6 +++---
 src/qemu/qemu_driver.c    |  4 ++--
 src/qemu/qemu_migration.c |  2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 87dc520f2c..c98d393f4b 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -386,12 +386,12 @@ qemuBlockJobUpdate(virDomainObjPtr vm,
  * @disk: domain disk
  *
  * Begin a new synchronous block job for @disk. The synchronous
- * block job is ended by a call to qemuBlockJobSyncEndDisk, or by
+ * block job is ended by a call to qemuBlockJobSyncEnd, or by
  * the guest quitting.
  *
  * During a synchronous block job, a block job event for @disk
  * will not be processed asynchronously. Instead, it will be
- * processed only when qemuBlockJobUpdate or qemuBlockJobSyncEndDisk
+ * processed only when qemuBlockJobUpdate or qemuBlockJobSyncEnd
  * is called.
  */
 void
@@ -409,7 +409,7 @@ qemuBlockJobSyncBegin(qemuBlockJobDataPtr job)


 /**
- * qemuBlockJobSyncEndDisk:
+ * qemuBlockJobSyncEnd:
  * @vm: domain
  * @disk: domain disk
  *
@@ -419,16 +419,16 @@ qemuBlockJobSyncBegin(qemuBlockJobDataPtr job)
  * qemuBlockJobStartupFinalize will be called.
  */
 void
-qemuBlockJobSyncEndDisk(virDomainObjPtr vm,
-                        int asyncJob,
-                        virDomainDiskDefPtr disk)
+qemuBlockJobSyncEnd(virDomainObjPtr vm,
+                    qemuBlockJobDataPtr job,
+                    int asyncJob)
 {
-    qemuBlockJobDataPtr job = QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob;
+    const char *diskdst = NULL;

-    if (!job)
-        return;
+    if (job->disk)
+        diskdst = job->disk->dst;

-    VIR_DEBUG("disk=%s", disk->dst);
+    VIR_DEBUG("disk=%s", NULLSTR(diskdst));
     qemuBlockJobUpdate(vm, job, asyncJob);
     job->synchronous = false;
 }
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
index 8c567ec886..0ec9fd17b7 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -99,9 +99,9 @@ int qemuBlockJobUpdate(virDomainObjPtr vm,
                        int asyncJob);

 void qemuBlockJobSyncBegin(qemuBlockJobDataPtr job);
-void qemuBlockJobSyncEndDisk(virDomainObjPtr vm,
-                             int asyncJob,
-                             virDomainDiskDefPtr disk);
+void qemuBlockJobSyncEnd(virDomainObjPtr vm,
+                         qemuBlockJobDataPtr job,
+                         int asyncJob);

 qemuBlockJobDataPtr
 qemuBlockJobGetByDisk(virDomainDiskDefPtr disk)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4ffa5b573d..ff113ae57b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17408,8 +17408,8 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
     }

  endjob:
-    if (disk)
-        qemuBlockJobSyncEndDisk(vm, QEMU_ASYNC_JOB_NONE, disk);
+    if (job && !async)
+        qemuBlockJobSyncEnd(vm, job, QEMU_ASYNC_JOB_NONE);
     qemuDomainObjEndJob(driver, vm);

  cleanup:
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index bed8eed563..4a6f631689 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -721,7 +721,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
                     err = virSaveLastError();
                 failed = true;
             }
-            qemuBlockJobSyncEndDisk(vm, asyncJob, disk);
+            qemuBlockJobSyncEnd(vm, job, asyncJob);
             diskPriv->migrating = false;
         }

-- 
2.19.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]