All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: eblake@redhat.com, armbru@redhat.com, xiechanglong.d@gmail.com,
	wencongyang2@huawei.com, stefanha@redhat.com, jsnow@redhat.com,
	famz@redhat.com, jcody@redhat.com, mreitz@redhat.com,
	kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org
Subject: [Qemu-devel] [PATCH v3 06/18] block/backup: give a name to copy-bitmap
Date: Mon,  1 Oct 2018 13:29:16 +0300	[thread overview]
Message-ID: <20181001102928.20533-7-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20181001102928.20533-1-vsementsov@virtuozzo.com>

The bitmap should be named to be shared with special filter node in
further patches. Make it possible to set this name in qmp command.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 qapi/block-core.json      | 18 ++++++++++++++++--
 include/block/block_int.h |  2 +-
 block/backup.c            | 10 ++++++++--
 block/replication.c       |  2 +-
 blockdev.c                | 12 ++++++++++--
 5 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/qapi/block-core.json b/qapi/block-core.json
index ac3b48ee54..c4774af18e 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1260,6 +1260,12 @@
 #          Must be present if sync is "incremental", must NOT be present
 #          otherwise. (Since 2.4)
 #
+# @x-copy-bitmap: the name for the copy-bitmap - the bitmap which drives the
+#                 backup process. At backup start it corresponds to @bitmap (or
+#                 just all bits set for full backup) and at the finish it
+#                 should be zero. If the bitmap already exists it will be used
+#                 as is. (Since 3.1)
+#
 # @compress: true to compress data, if the target format supports it.
 #            (default: false) (since 2.8)
 #
@@ -1297,7 +1303,8 @@
             '*bitmap': 'str', '*compress': 'bool',
             '*on-source-error': 'BlockdevOnError',
             '*on-target-error': 'BlockdevOnError',
-            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
+            '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
+            '*x-copy-bitmap': 'str' } }
 
 ##
 # @BlockdevBackup:
@@ -1340,6 +1347,12 @@
 #                list without user intervention.
 #                Defaults to true. (Since 2.12)
 #
+# @x-copy-bitmap: the name for the copy-bitmap - the bitmap which drives the
+#                 backup process. At backup start it corresponds to @bitmap (or
+#                 just all bits set for full backup) and at the finish it
+#                 should be zero. If the bitmap already exists it will be used
+#                 as is. (Since 3.1)
+#
 # Note: @on-source-error and @on-target-error only affect background
 # I/O.  If an error occurs during a guest write request, the device's
 # rerror/werror actions will be used.
@@ -1351,7 +1364,8 @@
             'sync': 'MirrorSyncMode', '*speed': 'int', '*compress': 'bool',
             '*on-source-error': 'BlockdevOnError',
             '*on-target-error': 'BlockdevOnError',
-            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
+            '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
+            '*x-copy-bitmap': 'str' } }
 
 ##
 # @blockdev-snapshot-sync:
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 92ecbd866e..13f4a0f98e 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -1087,7 +1087,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
                             bool compress,
                             BlockdevOnError on_source_error,
                             BlockdevOnError on_target_error,
-                            int creation_flags,
+                            int creation_flags, const char *x_copy_bitmap,
                             BlockCompletionFunc *cb, void *opaque,
                             JobTxn *txn, Error **errp);
 
diff --git a/block/backup.c b/block/backup.c
index 45212d54c9..ad143ea735 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -25,6 +25,7 @@
 #include "sysemu/block-backend.h"
 #include "qemu/bitmap.h"
 #include "qemu/error-report.h"
+#include "qemu/id.h"
 
 #define BACKUP_CLUSTER_SIZE_DEFAULT (1 << 16)
 
@@ -559,7 +560,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
                   bool compress,
                   BlockdevOnError on_source_error,
                   BlockdevOnError on_target_error,
-                  int creation_flags,
+                  int creation_flags, const char *x_copy_bitmap,
                   BlockCompletionFunc *cb, void *opaque,
                   JobTxn *txn, Error **errp)
 {
@@ -567,6 +568,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
     BlockDriverInfo bdi;
     BackupBlockJob *job = NULL;
     int ret;
+    char *gen_bitmap_name = NULL;
 
     assert(bs);
     assert(target);
@@ -684,8 +686,12 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
         job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size);
     }
 
+    if (!x_copy_bitmap) {
+        x_copy_bitmap = gen_bitmap_name = id_generate(ID_BLOCK_BITMAP);
+    }
     job->copy_bitmap = bdrv_create_dirty_bitmap(bs, job->cluster_size,
-                                                NULL, errp);
+                                                x_copy_bitmap, errp);
+    g_free(gen_bitmap_name);
     if (!job->copy_bitmap) {
         goto error;
     }
diff --git a/block/replication.c b/block/replication.c
index 0c2989d2cb..f4ff0bb034 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -548,7 +548,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
         job = backup_job_create(NULL, s->secondary_disk->bs, s->hidden_disk->bs,
                                 0, MIRROR_SYNC_MODE_NONE, NULL, false,
                                 BLOCKDEV_ON_ERROR_REPORT,
-                                BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL,
+                                BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL, NULL,
                                 backup_job_completed, bs, NULL, &local_err);
         if (local_err) {
             error_propagate(errp, local_err);
diff --git a/blockdev.c b/blockdev.c
index a8755bd908..407e03d22a 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3407,6 +3407,9 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
     if (!backup->has_compress) {
         backup->compress = false;
     }
+    if (!backup->has_x_copy_bitmap) {
+        backup->x_copy_bitmap = NULL;
+    }
 
     bs = qmp_get_root_bs(backup->device, errp);
     if (!bs) {
@@ -3511,7 +3514,8 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
     job = backup_job_create(backup->job_id, bs, target_bs, backup->speed,
                             backup->sync, bmap, backup->compress,
                             backup->on_source_error, backup->on_target_error,
-                            job_flags, NULL, NULL, txn, &local_err);
+                            job_flags, backup->x_copy_bitmap,
+                            NULL, NULL, txn, &local_err);
     bdrv_unref(target_bs);
     if (local_err != NULL) {
         error_propagate(errp, local_err);
@@ -3569,6 +3573,9 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn,
     if (!backup->has_compress) {
         backup->compress = false;
     }
+    if (!backup->has_x_copy_bitmap) {
+        backup->x_copy_bitmap = NULL;
+    }
 
     bs = bdrv_lookup_bs(backup->device, backup->device, errp);
     if (!bs) {
@@ -3603,7 +3610,8 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn,
     job = backup_job_create(backup->job_id, bs, target_bs, backup->speed,
                             backup->sync, NULL, backup->compress,
                             backup->on_source_error, backup->on_target_error,
-                            job_flags, NULL, NULL, txn, &local_err);
+                            job_flags, backup->x_copy_bitmap,
+                            NULL, NULL, txn, &local_err);
     if (local_err != NULL) {
         error_propagate(errp, local_err);
     }
-- 
2.18.0

  parent reply	other threads:[~2018-10-01 10:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01 10:29 [Qemu-devel] [PATCH v3 00/18] fleecing-hook driver for backup Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 01/18] block/dirty-bitmap: allow set/reset bits in disabled bitmaps Vladimir Sementsov-Ogievskiy
2018-10-03 14:23   ` Eric Blake
2018-10-03 14:50     ` Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 02/18] block/io: allow BDRV_REQ_SERIALISING for read Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 03/18] block/backup: simplify backup_incremental_init_copy_bitmap Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 04/18] block/backup: move from HBitmap to BdrvDirtyBitmap Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 05/18] util/id: add block-bitmap subsystem Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` Vladimir Sementsov-Ogievskiy [this message]
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 07/18] block/backup: allow use existent copy-bitmap Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 08/18] block: allow serialized reads to intersect Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 09/18] block: improve should_update_child Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 10/18] iotests: handle -f argument correctly for qemu_io_silent Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 11/18] iotests: allow resume_drive by node name Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 12/18] iotests: prepare 055 to graph changes during backup job Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 13/18] block: introduce new filter driver: fleecing-hook Vladimir Sementsov-Ogievskiy
2018-10-04 12:44   ` Kevin Wolf
2018-10-04 13:59     ` Vladimir Sementsov-Ogievskiy
2018-10-04 14:52       ` Kevin Wolf
2018-10-04 21:19         ` Vladimir Sementsov-Ogievskiy
2018-10-05 15:00           ` Vladimir Sementsov-Ogievskiy
2018-10-05 15:52             ` Kevin Wolf
2018-10-05 16:40               ` Vladimir Sementsov-Ogievskiy
2018-10-05 16:47                 ` Eric Blake
2018-10-05 18:31                   ` Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 14/18] block/fleecing-hook: internal api Vladimir Sementsov-Ogievskiy
2018-10-04 12:50   ` Kevin Wolf
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 15/18] qapi: add x-drop-fleecing qmp command Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 16/18] iotests: test new fleecing-hook driver in context of 222 iotest Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 17/18] block/backup: tiny refactor backup_job_create Vladimir Sementsov-Ogievskiy
2018-10-01 10:29 ` [Qemu-devel] [PATCH v3 18/18] block/backup: use fleecing-hook instead of write notifiers Vladimir Sementsov-Ogievskiy
2018-10-03 18:46   ` Vladimir Sementsov-Ogievskiy
2018-10-02 20:19 ` [Qemu-devel] [PATCH v3 00/18] fleecing-hook driver for backup Eric Blake
2018-10-03  9:55   ` Vladimir Sementsov-Ogievskiy
2018-10-03 15:36   ` Vladimir Sementsov-Ogievskiy

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=20181001102928.20533-7-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wencongyang2@huawei.com \
    --cc=xiechanglong.d@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.