[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v14 3/8] Backup: clear all bitmap when doing blo

From: Changlong Xie
Subject: Re: [Qemu-devel] [PATCH v14 3/8] Backup: clear all bitmap when doing block checkpoint
Date: Thu, 28 Jan 2016 10:22:03 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 01/28/2016 12:05 AM, Stefan Hajnoczi wrote:
On Wed, Jan 13, 2016 at 05:18:27PM +0800, Changlong Xie wrote:
diff --git a/blockjob.c b/blockjob.c
index 80adb9d..0c8edfe 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -533,3 +533,14 @@ void block_job_txn_add_job(BlockJobTxn *txn, BlockJob *job)
      QLIST_INSERT_HEAD(&txn->jobs, job, txn_list);
+void block_job_do_checkpoint(BlockJob *job, Error **errp)
+    if (!job->driver->do_checkpoint) {
+        error_setg(errp, "The job %s doesn't support block checkpoint",
+                   BlockJobType_lookup[job->driver->job_type]);
+        return;
+    }
+    job->driver->do_checkpoint(job, errp);
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index d84ccd8..abdba7c 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -70,6 +70,9 @@ typedef struct BlockJobDriver {
       * never both.
      void (*abort)(BlockJob *job);
+    /** Optional callback for job types that support checkpoint. */
+    void (*do_checkpoint)(BlockJob *job, Error **errp);

The COLO/replication-specific callbacks have been moved out of
BlockDriver into their own replication struct.  Similar reasoning
applies to BlockJobDriver:

The do_checkpoint() callback is only implemented by one type of job and
its purpose is related to COLO rather than jobs.  This is a strong
indication that this shouldn't be part of the generic BlockJobDriver

Please drop changes to the generic blockjob interface.  Instead, make
backup_do_checkpoint() public and add assert(job->driver->type ==
BLOCK_JOB_TYPE_BACKUP) into the function.

Then the replication filter can call backup_do_checkpoint() directly.

Will fix it in next version.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]