qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-block@nongnu.org
Cc: vsementsov@virtuozzo.com, famz@redhat.com,
	John Snow <jsnow@redhat.com>,
	armbru@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v11 10/14] block/backup: Rely on commit/abort for cleanup
Date: Thu,  5 Nov 2015 18:13:16 -0500	[thread overview]
Message-ID: <1446765200-3054-11-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1446765200-3054-1-git-send-email-jsnow@redhat.com>

Switch over to the new .commit/.abort handlers for
cleaning up incremental bitmaps.

[split up from a patch originally by Stefan and Fam. --js]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>

Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/backup.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/block/backup.c b/block/backup.c
index f7fcb99..a80800f 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -237,11 +237,29 @@ static void backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret)
     }
 }
 
+static void backup_commit(BlockJob *job)
+{
+    BackupBlockJob *s = container_of(job, BackupBlockJob, common);
+    if (s->sync_bitmap) {
+        backup_cleanup_sync_bitmap(s, 0);
+    }
+}
+
+static void backup_abort(BlockJob *job)
+{
+    BackupBlockJob *s = container_of(job, BackupBlockJob, common);
+    if (s->sync_bitmap) {
+        backup_cleanup_sync_bitmap(s, -1);
+    }
+}
+
 static const BlockJobDriver backup_job_driver = {
     .instance_size  = sizeof(BackupBlockJob),
     .job_type       = BLOCK_JOB_TYPE_BACKUP,
     .set_speed      = backup_set_speed,
     .iostatus_reset = backup_iostatus_reset,
+    .commit         = backup_commit,
+    .abort          = backup_abort,
 };
 
 static BlockErrorAction backup_error_action(BackupBlockJob *job,
@@ -457,10 +475,6 @@ static void coroutine_fn backup_run(void *opaque)
     /* wait until pending backup_do_cow() calls have completed */
     qemu_co_rwlock_wrlock(&job->flush_rwlock);
     qemu_co_rwlock_unlock(&job->flush_rwlock);
-
-    if (job->sync_bitmap) {
-        backup_cleanup_sync_bitmap(job, ret);
-    }
     hbitmap_free(job->bitmap);
 
     if (target->blk) {
-- 
2.4.3

  parent reply	other threads:[~2015-11-05 23:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 23:13 [Qemu-devel] [PATCH v11 00/14] block: incremental backup transactions using BlockJobTxn John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 01/14] qapi: Add transaction support to block-dirty-bitmap operations John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 02/14] iotests: add transactional incremental backup test John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 03/14] block: rename BlkTransactionState and BdrvActionOps John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 04/14] backup: Extract dirty bitmap handling as a separate function John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 05/14] blockjob: Introduce reference count and fix reference to job->bs John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 06/14] blockjob: Add .commit and .abort block job actions John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 07/14] blockjob: Add "completed" and "ret" in BlockJob John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 08/14] blockjob: Simplify block_job_finish_sync John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 09/14] block: Add block job transactions John Snow
2015-11-05 23:13 ` John Snow [this message]
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 11/14] block: Add BlockJobTxn support to backup_run John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 12/14] block: add transactional properties John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 13/14] iotests: 124 - transactional failure test John Snow
2015-11-05 23:13 ` [Qemu-devel] [PATCH v11 14/14] tests: add BlockJobTxn unit test John Snow
2015-11-10 13:34 ` [Qemu-devel] [PATCH v11 00/14] block: incremental backup transactions using BlockJobTxn Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446765200-3054-11-git-send-email-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=famz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).