All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com,
	armbru@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com,
	andrey.shinkevich@virtuozzo.com, den@openvz.org,
	mreitz@redhat.com, jsnow@redhat.com
Subject: [PATCH v4 09/15] block: prepare block-stream for using COR-filter
Date: Tue, 12 May 2020 19:50:39 +0300	[thread overview]
Message-ID: <1589302245-893269-10-git-send-email-andrey.shinkevich@virtuozzo.com> (raw)
In-Reply-To: <1589302245-893269-1-git-send-email-andrey.shinkevich@virtuozzo.com>

This patch is the first one in the series where the COR-filter node
will be hard-coded for using in the block-stream job. The block jobs
may be run in parallel. Exclude conflicts with filter nodes used for
a concurrent job while checking for the blocked operations. It incurs
changes in the iotests 030::test_overlapping_4 that now passes with no
conflict because the stream job does not have a real dependency on its
base and on a filter above it.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
---
 blockdev.c             | 11 +++++++++--
 tests/qemu-iotests/030 |  9 ++++-----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index b3c840e..97c2ba2 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2763,6 +2763,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
     Error *local_err = NULL;
     const char *base_name = NULL;
     int job_flags = JOB_DEFAULT;
+    BlockDriverState *bottom_cow_node;
 
     if (!has_on_error) {
         on_error = BLOCKDEV_ON_ERROR_REPORT;
@@ -2807,8 +2808,14 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
         base_name = base_bs->filename;
     }
 
-    /* Check for op blockers in the whole chain between bs and base */
-    for (iter = bs; iter && iter != base_bs; iter = backing_bs(iter)) {
+    bottom_cow_node = bdrv_find_overlay(bs, base_bs);
+    if (!bottom_cow_node) {
+        error_setg(errp, "bottom node is not found, nothing to stream");
+        goto out;
+    }
+    /* Check for op blockers in the whole chain between bs and bottom */
+    for (iter = bs; iter && iter != bdrv_filtered_bs(bottom_cow_node);
+         iter = bdrv_filtered_bs(iter)) {
         if (bdrv_op_is_blocked(iter, BLOCK_OP_TYPE_STREAM, errp)) {
             goto out;
         }
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index 104e3ce..d7638cd 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -368,8 +368,7 @@ class TestParallelOps(iotests.QMPTestCase):
         self.wait_until_completed(drive='commit-drive0')
 
     # In this case the base node of the stream job is the same as the
-    # top node of commit job. Since this results in the commit filter
-    # node being part of the stream chain, this is not allowed.
+    # top node of commit job.
     def test_overlapping_4(self):
         self.assert_no_active_block_jobs()
 
@@ -381,13 +380,13 @@ class TestParallelOps(iotests.QMPTestCase):
 
         # Stream from node2 into node4
         result = self.vm.qmp('block-stream', device='node4', base_node='node2', job_id='node4')
-        self.assert_qmp(result, 'error/desc',
-            "Cannot freeze 'backing' link to 'commit-filter'")
+        self.assert_qmp(result, 'return', {})
 
         result = self.vm.qmp('block-job-set-speed', device='drive0', speed=0)
         self.assert_qmp(result, 'return', {})
 
-        self.wait_until_completed()
+        self.vm.run_job(job='drive0', auto_dismiss=True)
+        self.vm.run_job(job='node4', auto_dismiss=True)
         self.assert_no_active_block_jobs()
 
     # In this case the base node of the stream job is the commit job's
-- 
1.8.3.1



  parent reply	other threads:[~2020-05-12 17:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 16:50 [PATCH v4 00/15] Apply COR-filter to the block-stream permanently Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 01/15] block: Mark commit and mirror as filter drivers Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 02/15] copy-on-read: Support compressed writes Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 03/15] block: Add child access functions Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 04/15] block: Add chain helper functions Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 05/15] block: Include filters when freezing backing chain Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 06/15] block: Use CAFs in block status functions Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 07/15] commit: Deal with filters when blocking intermediate nodes Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 08/15] block: Use CAFs when working with backing chains Andrey Shinkevich
2020-05-12 16:50 ` Andrey Shinkevich [this message]
2020-05-12 16:50 ` [PATCH v4 10/15] copy-on-read: Support change filename functions Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 11/15] copy-on-read: Support preadv/pwritev_part functions Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 12/15] copy-on-read: add filter append/drop functions Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 13/15] qapi: add filter-node-name to block-stream Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 14/15] iotests: prepare 245 for using filter in block-stream Andrey Shinkevich
2020-05-12 16:50 ` [PATCH v4 15/15] block: apply COR-filter to block-stream jobs Andrey Shinkevich
2020-05-12 17:56 ` [PATCH v4 00/15] Apply COR-filter to the block-stream permanently Vladimir Sementsov-Ogievskiy
2020-05-13 14:06   ` Vladimir Sementsov-Ogievskiy
2020-05-13  0:09 ` no-reply
2020-05-13  0:13 ` no-reply
2020-05-13  0:15 ` no-reply

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=1589302245-893269-10-git-send-email-andrey.shinkevich@virtuozzo.com \
    --to=andrey.shinkevich@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=fam@euphon.net \
    --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=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 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.