qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, den@openvz.org, vsementsov@virtuozzo.com,
	dautovri@hpcdlab.com
Subject: [PATCH 4/5] block/prl-xml: add bdrv_check
Date: Fri, 13 Nov 2020 15:58:47 +0300	[thread overview]
Message-ID: <20201113125848.20498-5-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20201113125848.20498-1-vsementsov@virtuozzo.com>

From: Klim Kireev <klim.kireev@virtuozzo.com>

Add bdrv_check, which just checks child image and all backings.

Signed-off-by: Klim Kireev <klim.kireev@virtuozzo.com>
---
 block/prl-xml.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/block/prl-xml.c b/block/prl-xml.c
index 023651342c..736cd98469 100644
--- a/block/prl-xml.c
+++ b/block/prl-xml.c
@@ -520,6 +520,23 @@ static coroutine_fn int prl_co_flush_to_os(BlockDriverState *bs)
     return bdrv_co_flush(s->image->bs);
 }
 
+static coroutine_fn int prl_co_check_xml(BlockDriverState *bs, 
+                                        BdrvCheckResult *result,
+                                        BdrvCheckMode fix) {
+    BDRVPrlXmlState *s = bs->opaque;
+    BdrvChild *cur = s->image;
+    int ret = 0;
+
+    while (cur != NULL && ret >= 0) {
+        if (cur->bs->drv->bdrv_co_check != NULL) {
+            ret = bdrv_check(cur->bs, result, fix);
+        }
+        cur = cur->bs->backing;
+    }
+
+    return ret;
+}
+
 static BlockDriver bdrv_prl_xml = {
     .format_name                = "prl-xml",
     .instance_size              = sizeof(BDRVPrlXmlState),
@@ -529,6 +546,7 @@ static BlockDriver bdrv_prl_xml = {
     .bdrv_co_writev             = prl_co_writev,
     .bdrv_close                 = prl_close_xml,
     .bdrv_co_flush_to_os        = prl_co_flush_to_os,
+    .bdrv_co_check              = prl_co_check_xml,
     .create_opts                = &prl_xml_create_opts,
     .bdrv_child_perm            = bdrv_filter_default_perms,
     .is_filter                  = true
-- 
2.21.3



  parent reply	other threads:[~2020-11-13 13:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 12:58 [PATCH RFC 0/5] block: implement Parallels Disk format driver Vladimir Sementsov-Ogievskiy
2020-11-13 12:58 ` [PATCH 1/5] block/prl-xml: add Parallels xml BlockDriver Vladimir Sementsov-Ogievskiy
2020-11-13 12:58 ` [PATCH 2/5] block/prl-xml: add bdrv_co_readv/writev and flush Vladimir Sementsov-Ogievskiy
2020-11-13 12:58 ` [PATCH 3/5] block/prl-xml: add bdrv_probe Vladimir Sementsov-Ogievskiy
2020-11-13 12:58 ` Vladimir Sementsov-Ogievskiy [this message]
2020-11-13 12:58 ` [PATCH 5/5] iotests: add test for prl-xml format 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=20201113125848.20498-5-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=dautovri@hpcdlab.com \
    --cc=den@openvz.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).