qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, vsementsov@virtuozzo.com,
	eblake@redhat.com, armbru@redhat.com, xiechanglong.d@gmail.com,
	wencongyang2@huawei.com, jsnow@redhat.com, mreitz@redhat.com,
	kwolf@redhat.com, den@openvz.org
Subject: [PATCH v3 11/25] qapi: backup: add max-chunk and max-workers to x-perf struct
Date: Mon, 26 Oct 2020 20:18:01 +0300	[thread overview]
Message-ID: <20201026171815.13233-12-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20201026171815.13233-1-vsementsov@virtuozzo.com>

Add new parameters to configure future backup features. The patch
doesn't introduce aio backup requests (so we actually have only one
worker) neither requests larger than one cluster. Still, formally we
satisfy these maximums anyway, so add the parameters now, to facilitate
further patch which will really change backup job behavior.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 qapi/block-core.json | 11 ++++++++++-
 block/backup.c       | 28 +++++++++++++++++++++++-----
 block/replication.c  |  2 +-
 blockdev.c           |  8 +++++++-
 4 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/qapi/block-core.json b/qapi/block-core.json
index 71e6faa15c..5a21c24c1d 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1378,10 +1378,19 @@
 #
 # @use-copy-range: Use copy offloading. Default true.
 #
+# @max-workers: Maximum number of parallel requests for the sustained background
+#               copying process. Doesn't influence copy-before-write operations.
+#               Default 64.
+#
+# @max-chunk: Maximum request length for the sustained background copying
+#             process. Doesn't influence copy-before-write operations.
+#             0 means unlimited. Default 0.
+#
 # Since: 5.2
 ##
 { 'struct': 'BackupPerf',
-  'data': { '*use-copy-range': 'bool' }}
+  'data': { '*use-copy-range': 'bool',
+            '*max-workers': 'int', '*max-chunk': 'int64' } }
 
 ##
 # @BackupCommon:
diff --git a/block/backup.c b/block/backup.c
index 09ff5a92ef..8c67d77504 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -388,6 +388,29 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
         return NULL;
     }
 
+    cluster_size = backup_calculate_cluster_size(target, errp);
+    if (cluster_size < 0) {
+        goto error;
+    }
+
+    if (perf->max_workers < 1) {
+        error_setg(errp, "max-worker must be greater than zero");
+        return NULL;
+    }
+
+    if (perf->max_chunk < 0) {
+        error_setg(errp, "max-chunk must be zero (which means no limit) or "
+                   "positive");
+        return NULL;
+    }
+
+    if (perf->max_chunk && perf->max_chunk < cluster_size) {
+        error_setg(errp, "Required max-chunk (%" PRIi64 ") is less than backup "
+                   "cluster size (%" PRIi64 ")", perf->max_chunk, cluster_size);
+        return NULL;
+    }
+
+
     if (sync_bitmap) {
         /* If we need to write to this bitmap, check that we can: */
         if (bitmap_mode != BITMAP_SYNC_MODE_NEVER &&
@@ -420,11 +443,6 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
         goto error;
     }
 
-    cluster_size = backup_calculate_cluster_size(target, errp);
-    if (cluster_size < 0) {
-        goto error;
-    }
-
     /*
      * If source is in backing chain of target assume that target is going to be
      * used for "image fleecing", i.e. it should represent a kind of snapshot of
diff --git a/block/replication.c b/block/replication.c
index 22ffc811ee..97be7ef4de 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -454,7 +454,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
     int64_t active_length, hidden_length, disk_length;
     AioContext *aio_context;
     Error *local_err = NULL;
-    BackupPerf perf = { .use_copy_range = true };
+    BackupPerf perf = { .use_copy_range = true, .max_workers = 1 };
 
     aio_context = bdrv_get_aio_context(bs);
     aio_context_acquire(aio_context);
diff --git a/blockdev.c b/blockdev.c
index b71ed08a3b..0ed390abe0 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2788,7 +2788,7 @@ static BlockJob *do_backup_common(BackupCommon *backup,
 {
     BlockJob *job = NULL;
     BdrvDirtyBitmap *bmap = NULL;
-    BackupPerf perf = { .use_copy_range = true };
+    BackupPerf perf = { .use_copy_range = true, .max_workers = 64 };
     int job_flags = JOB_DEFAULT;
 
     if (!backup->has_speed) {
@@ -2817,6 +2817,12 @@ static BlockJob *do_backup_common(BackupCommon *backup,
         if (backup->x_perf->has_use_copy_range) {
             perf.use_copy_range = backup->x_perf->use_copy_range;
         }
+        if (backup->x_perf->has_max_workers) {
+            perf.max_workers = backup->x_perf->max_workers;
+        }
+        if (backup->x_perf->has_max_chunk) {
+            perf.max_chunk = backup->x_perf->max_chunk;
+        }
     }
 
     if ((backup->sync == MIRROR_SYNC_MODE_BITMAP) ||
-- 
2.21.3



  parent reply	other threads:[~2020-10-26 17:46 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 17:17 [PATCH v3 00/25] backup performance: block_status + async Vladimir Sementsov-Ogievskiy
2020-10-26 17:17 ` [PATCH v3 01/25] iotests: 129 don't check backup "busy" Vladimir Sementsov-Ogievskiy
2020-10-26 17:17 ` [PATCH v3 02/25] qapi: backup: add perf.use-copy-range parameter Vladimir Sementsov-Ogievskiy
2021-01-11 16:07   ` Max Reitz
2021-01-19 20:21   ` Eric Blake
2021-01-20  6:09     ` Vladimir Sementsov-Ogievskiy
2021-01-20  8:24       ` Max Reitz
2020-10-26 17:17 ` [PATCH v3 03/25] block/block-copy: More explicit call_state Vladimir Sementsov-Ogievskiy
2020-10-26 17:17 ` [PATCH v3 04/25] block/block-copy: implement block_copy_async Vladimir Sementsov-Ogievskiy
2021-01-11 16:27   ` Max Reitz
2020-10-26 17:17 ` [PATCH v3 05/25] block/block-copy: add max_chunk and max_workers parameters Vladimir Sementsov-Ogievskiy
2021-01-11 16:47   ` Max Reitz
2020-10-26 17:17 ` [PATCH v3 06/25] block/block-copy: add list of all call-states Vladimir Sementsov-Ogievskiy
2021-01-11 17:02   ` Max Reitz
2020-10-26 17:17 ` [PATCH v3 07/25] block/block-copy: add ratelimit to block-copy Vladimir Sementsov-Ogievskiy
2021-01-12 10:48   ` Max Reitz
2020-10-26 17:17 ` [PATCH v3 08/25] block/block-copy: add block_copy_cancel Vladimir Sementsov-Ogievskiy
2021-01-12 11:05   ` Max Reitz
2020-10-26 17:17 ` [PATCH v3 09/25] blockjob: add set_speed to BlockJobDriver Vladimir Sementsov-Ogievskiy
2020-10-26 17:18 ` [PATCH v3 10/25] job: call job_enter from job_user_pause Vladimir Sementsov-Ogievskiy
2020-10-26 17:18 ` Vladimir Sementsov-Ogievskiy [this message]
2020-11-09 12:23   ` [PATCH v3 11/25] qapi: backup: add max-chunk and max-workers to x-perf struct Vladimir Sementsov-Ogievskiy
2021-01-12 11:59   ` Max Reitz
2020-10-26 17:18 ` [PATCH v3 12/25] iotests: 56: prepare for backup over block-copy Vladimir Sementsov-Ogievskiy
2021-01-12 12:07   ` Max Reitz
2020-10-26 17:18 ` [PATCH v3 13/25] iotests: 129: " Vladimir Sementsov-Ogievskiy
2021-01-12 12:14   ` Max Reitz
2021-01-16 21:03     ` Vladimir Sementsov-Ogievskiy
2020-10-26 17:18 ` [PATCH v3 14/25] iotests: 185: " Vladimir Sementsov-Ogievskiy
2020-10-26 17:18 ` [PATCH v3 15/25] iotests: 219: " Vladimir Sementsov-Ogievskiy
2021-01-12 12:32   ` Max Reitz
2020-10-26 17:18 ` [PATCH v3 16/25] iotests: 257: " Vladimir Sementsov-Ogievskiy
2020-10-26 17:18 ` [PATCH v3 17/25] block/block-copy: make progress_bytes_callback optional Vladimir Sementsov-Ogievskiy
2021-01-12 12:39   ` Max Reitz
2020-10-26 17:18 ` [PATCH v3 18/25] block/backup: drop extra gotos from backup_run() Vladimir Sementsov-Ogievskiy
2021-01-12 12:40   ` Max Reitz
2020-10-26 17:18 ` [PATCH v3 19/25] backup: move to block-copy Vladimir Sementsov-Ogievskiy
2021-01-12 13:23   ` Max Reitz
2021-01-12 15:27     ` Vladimir Sementsov-Ogievskiy
2020-10-26 17:18 ` [PATCH v3 20/25] qapi: backup: disable copy_range by default Vladimir Sementsov-Ogievskiy
2021-01-12 14:05   ` Max Reitz
2021-01-12 15:44     ` Vladimir Sementsov-Ogievskiy
2021-01-12 15:55       ` Max Reitz
2020-10-26 17:18 ` [PATCH v3 21/25] block/block-copy: drop unused block_copy_set_progress_callback() Vladimir Sementsov-Ogievskiy
2021-01-12 14:07   ` Max Reitz
2020-10-26 17:18 ` [PATCH v3 22/25] block/block-copy: drop unused argument of block_copy() Vladimir Sementsov-Ogievskiy
2020-10-26 17:18 ` [PATCH v3 23/25] simplebench/bench_block_job: use correct shebang line with python3 Vladimir Sementsov-Ogievskiy
2021-01-12 14:10   ` Max Reitz
2020-10-26 17:18 ` [PATCH v3 24/25] simplebench: bench_block_job: add cmd_options argument Vladimir Sementsov-Ogievskiy
2020-10-26 17:18 ` [PATCH v3 25/25] simplebench: add bench-backup.py Vladimir Sementsov-Ogievskiy
2021-01-12 14:50   ` Max Reitz
2021-01-12 17:12     ` Vladimir Sementsov-Ogievskiy
2021-01-09 10:18 ` [PATCH v3 00/25] backup performance: block_status + async 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=20201026171815.13233-12-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@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=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 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).