From: Jeff Cody <jcody@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: berto@igalia.com, qemu-block@nongnu.org, qemu-devel@nongnu.org,
armbru@redhat.com, stefanha@redhat.com, famz@redhat.com,
mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 03/16] blkverify: Convert s->test_file to BdrvChild
Date: Mon, 12 Oct 2015 20:57:03 -0400 [thread overview]
Message-ID: <20151013005703.GJ11943@localhost.localdomain> (raw)
In-Reply-To: <1444392941-28704-4-git-send-email-kwolf@redhat.com>
On Fri, Oct 09, 2015 at 02:15:28PM +0200, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> Reviewed-by: Max Reitz <mreitz@redhat.com>
> Reviewed-by: Alberto Garcia <berto@igalia.com>
> Reviewed-by: Fam Zheng <famz@redhat.com>
> ---
> block/blkverify.c | 41 +++++++++++++++++++++--------------------
> 1 file changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/block/blkverify.c b/block/blkverify.c
> index d277e63..6b71622 100644
> --- a/block/blkverify.c
> +++ b/block/blkverify.c
> @@ -14,7 +14,7 @@
> #include "qapi/qmp/qstring.h"
>
> typedef struct {
> - BlockDriverState *test_file;
> + BdrvChild *test_file;
> } BDRVBlkverifyState;
>
> typedef struct BlkverifyAIOCB BlkverifyAIOCB;
> @@ -132,12 +132,12 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
> }
>
> /* Open the test file */
> - assert(s->test_file == NULL);
> - ret = bdrv_open_image(&s->test_file, qemu_opt_get(opts, "x-image"), options,
> - "test", bs, &child_format, false, &local_err);
> - if (ret < 0) {
> + s->test_file = bdrv_open_child(qemu_opt_get(opts, "x-image"), options,
> + "test", bs, &child_format, false,
> + &local_err);
> + if (local_err) {
> + ret = -EINVAL;
> error_propagate(errp, local_err);
> - s->test_file = NULL;
> goto fail;
> }
>
> @@ -151,7 +151,7 @@ static void blkverify_close(BlockDriverState *bs)
> {
> BDRVBlkverifyState *s = bs->opaque;
>
> - bdrv_unref(s->test_file);
> + bdrv_unref_child(bs, s->test_file);
> s->test_file = NULL;
> }
>
> @@ -159,7 +159,7 @@ static int64_t blkverify_getlength(BlockDriverState *bs)
> {
> BDRVBlkverifyState *s = bs->opaque;
>
> - return bdrv_getlength(s->test_file);
> + return bdrv_getlength(s->test_file->bs);
> }
>
> static BlkverifyAIOCB *blkverify_aio_get(BlockDriverState *bs, bool is_write,
> @@ -242,7 +242,7 @@ static BlockAIOCB *blkverify_aio_readv(BlockDriverState *bs,
> qemu_iovec_init(&acb->raw_qiov, acb->qiov->niov);
> qemu_iovec_clone(&acb->raw_qiov, qiov, acb->buf);
>
> - bdrv_aio_readv(s->test_file, sector_num, qiov, nb_sectors,
> + bdrv_aio_readv(s->test_file->bs, sector_num, qiov, nb_sectors,
> blkverify_aio_cb, acb);
> bdrv_aio_readv(bs->file, sector_num, &acb->raw_qiov, nb_sectors,
> blkverify_aio_cb, acb);
> @@ -257,7 +257,7 @@ static BlockAIOCB *blkverify_aio_writev(BlockDriverState *bs,
> BlkverifyAIOCB *acb = blkverify_aio_get(bs, true, sector_num, qiov,
> nb_sectors, cb, opaque);
>
> - bdrv_aio_writev(s->test_file, sector_num, qiov, nb_sectors,
> + bdrv_aio_writev(s->test_file->bs, sector_num, qiov, nb_sectors,
> blkverify_aio_cb, acb);
> bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors,
> blkverify_aio_cb, acb);
> @@ -271,7 +271,7 @@ static BlockAIOCB *blkverify_aio_flush(BlockDriverState *bs,
> BDRVBlkverifyState *s = bs->opaque;
>
> /* Only flush test file, the raw file is not important */
> - return bdrv_aio_flush(s->test_file, cb, opaque);
> + return bdrv_aio_flush(s->test_file->bs, cb, opaque);
> }
>
> static bool blkverify_recurse_is_first_non_filter(BlockDriverState *bs,
> @@ -285,7 +285,7 @@ static bool blkverify_recurse_is_first_non_filter(BlockDriverState *bs,
> return true;
> }
>
> - return bdrv_recurse_is_first_non_filter(s->test_file, candidate);
> + return bdrv_recurse_is_first_non_filter(s->test_file->bs, candidate);
> }
>
> /* Propagate AioContext changes to ->test_file */
> @@ -293,7 +293,7 @@ static void blkverify_detach_aio_context(BlockDriverState *bs)
> {
> BDRVBlkverifyState *s = bs->opaque;
>
> - bdrv_detach_aio_context(s->test_file);
> + bdrv_detach_aio_context(s->test_file->bs);
> }
>
> static void blkverify_attach_aio_context(BlockDriverState *bs,
> @@ -301,7 +301,7 @@ static void blkverify_attach_aio_context(BlockDriverState *bs,
> {
> BDRVBlkverifyState *s = bs->opaque;
>
> - bdrv_attach_aio_context(s->test_file, new_context);
> + bdrv_attach_aio_context(s->test_file->bs, new_context);
> }
>
> static void blkverify_refresh_filename(BlockDriverState *bs)
> @@ -309,24 +309,25 @@ static void blkverify_refresh_filename(BlockDriverState *bs)
> BDRVBlkverifyState *s = bs->opaque;
>
> /* bs->file has already been refreshed */
> - bdrv_refresh_filename(s->test_file);
> + bdrv_refresh_filename(s->test_file->bs);
>
> - if (bs->file->full_open_options && s->test_file->full_open_options) {
> + if (bs->file->full_open_options && s->test_file->bs->full_open_options) {
> QDict *opts = qdict_new();
> qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("blkverify")));
>
> QINCREF(bs->file->full_open_options);
> qdict_put_obj(opts, "raw", QOBJECT(bs->file->full_open_options));
> - QINCREF(s->test_file->full_open_options);
> - qdict_put_obj(opts, "test", QOBJECT(s->test_file->full_open_options));
> + QINCREF(s->test_file->bs->full_open_options);
> + qdict_put_obj(opts, "test",
> + QOBJECT(s->test_file->bs->full_open_options));
>
> bs->full_open_options = opts;
> }
>
> - if (bs->file->exact_filename[0] && s->test_file->exact_filename[0]) {
> + if (bs->file->exact_filename[0] && s->test_file->bs->exact_filename[0]) {
> snprintf(bs->exact_filename, sizeof(bs->exact_filename),
> "blkverify:%s:%s",
> - bs->file->exact_filename, s->test_file->exact_filename);
> + bs->file->exact_filename, s->test_file->bs->exact_filename);
> }
> }
>
> --
> 1.8.3.1
>
Reviewed-by: Jeff Cody <jcody@redhat.com>
next prev parent reply other threads:[~2015-10-13 0:57 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 12:15 [Qemu-devel] [PATCH v3 00/16] block: Get rid of bdrv_swap() Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 01/16] block: Introduce BDS.file_child Kevin Wolf
2015-10-13 0:43 ` Jeff Cody
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 02/16] vmdk: Use BdrvChild instead of BDS for references to extents Kevin Wolf
2015-10-13 0:55 ` Jeff Cody
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 03/16] blkverify: Convert s->test_file to BdrvChild Kevin Wolf
2015-10-13 0:57 ` Jeff Cody [this message]
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 04/16] quorum: Convert " Kevin Wolf
2015-10-13 0:58 ` Jeff Cody
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 05/16] block: Convert bs->file " Kevin Wolf
2015-10-13 1:33 ` Jeff Cody
2015-10-13 8:59 ` Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 06/16] block: Remove bdrv_open_image() Kevin Wolf
2015-10-13 1:33 ` Jeff Cody
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 07/16] block: Convert bs->backing_hd to BdrvChild Kevin Wolf
2015-10-12 13:07 ` Alberto Garcia
2015-10-12 16:55 ` Max Reitz
2015-10-13 1:53 ` Jeff Cody
2015-10-13 8:31 ` Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 08/16] block: Manage backing file references in bdrv_set_backing_hd() Kevin Wolf
2015-10-12 13:29 ` Alberto Garcia
2015-10-12 17:13 ` Max Reitz
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 09/16] block: Split bdrv_move_feature_fields() Kevin Wolf
2015-10-12 13:47 ` Alberto Garcia
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 10/16] block/io: Make bdrv_requests_pending() public Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 11/16] block-backend: Add blk_set_bs() Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 12/16] block: Introduce parents list Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 13/16] block: Implement bdrv_append() without bdrv_swap() Kevin Wolf
2015-10-12 14:27 ` Alberto Garcia
2015-10-13 8:39 ` Kevin Wolf
2015-10-13 9:01 ` Alberto Garcia
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 14/16] blockjob: Store device name at job creation Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 15/16] block: Add and use bdrv_replace_in_backing_chain() Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 16/16] block: Remove bdrv_swap() Kevin Wolf
2015-10-13 10:25 ` [Qemu-devel] [PATCH v3 00/16] block: Get rid of bdrv_swap() Stefan Hajnoczi
2015-10-13 11:18 ` Kevin Wolf
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=20151013005703.GJ11943@localhost.localdomain \
--to=jcody@redhat.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).