From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, Fam Zheng <fam@euphon.net>,
"open list:Sheepdog" <sheepdog@lists.wpkg.org>,
qemu-block@nongnu.org, Jeff Cody <codyprime@gmail.com>,
Stefan Weil <sw@weilnetz.de>,
Markus Armbruster <armbru@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Liu Yuan <namei.unix@gmail.com>,
"Denis V. Lunev" <den@openvz.org>, John Snow <jsnow@redhat.com>
Subject: Re: [PATCH v2 1/3] block: Add blk_new_with_bs() helper
Date: Fri, 24 Apr 2020 11:53:53 +0200 [thread overview]
Message-ID: <307f7619-5e4a-10c1-7d49-8ee6bb8d650c@redhat.com> (raw)
In-Reply-To: <20200423221707.477404-2-eblake@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 2037 bytes --]
On 24.04.20 00:17, Eric Blake wrote:
> There are several callers that need to create a new block backend from
> an existing BDS; make the task slightly easier with a common helper
> routine.
>
> Suggested-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> include/sysemu/block-backend.h | 2 ++
> block/block-backend.c | 23 +++++++++++++++++++++++
> block/crypto.c | 8 +++-----
> block/parallels.c | 7 +++----
> block/qcow.c | 7 +++----
> block/qcow2.c | 15 ++++++---------
> block/qed.c | 7 +++----
> block/sheepdog.c | 9 ++++-----
> block/vdi.c | 7 +++----
> block/vhdx.c | 7 +++----
> block/vmdk.c | 9 ++++-----
> block/vpc.c | 7 +++----
> blockdev.c | 8 +++-----
> blockjob.c | 7 ++-----
> 14 files changed, 65 insertions(+), 58 deletions(-)
Reviewed-by: Max Reitz <mreitz@redhat.com>
> diff --git a/blockdev.c b/blockdev.c
> index 5faddaa7052f..f43426ed5fbc 100644
> --- a/blockdev.c
> +++ b/blockdev.c
[...]
> @@ -2734,14 +2733,13 @@ void qmp_block_resize(bool has_device, const char *device,
> goto out;
> }
>
> - blk = blk_new(bdrv_get_aio_context(bs), BLK_PERM_RESIZE, BLK_PERM_ALL);
> - ret = blk_insert_bs(blk, bs, errp);
> - if (ret < 0) {
> + blk = blk_new_with_bs(bs, BLK_PERM_RESIZE, BLK_PERM_ALL, errp);
> + if (!blk) {
> goto out;
> }
>
> bdrv_drained_begin(bs);
> - ret = blk_truncate(blk, size, false, PREALLOC_MODE_OFF, errp);
> + blk_truncate(blk, size, false, PREALLOC_MODE_OFF, errp);
This is also addressed by
https://lists.nongnu.org/archive/html/qemu-devel/2020-04/msg03656.html,
but it does make sense to fix it here, too. Well, whichever lands first
lands first, I suppose (so @ret can be dropped).
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-04-24 9:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 22:17 [PATCH v2 0/3] qcow2: Allow resize of images with internal snapshots Eric Blake
2020-04-23 22:17 ` [PATCH v2 1/3] block: Add blk_new_with_bs() helper Eric Blake
2020-04-24 9:53 ` Max Reitz [this message]
2020-04-24 9:56 ` Max Reitz
2020-04-24 10:02 ` Max Reitz
2020-04-24 14:18 ` Eric Blake
2020-04-24 14:25 ` Max Reitz
2020-04-24 12:23 ` Stefan Hajnoczi
2020-04-23 22:17 ` [PATCH v2 2/3] qcow2: Allow resize of images with internal snapshots Eric Blake
2020-04-24 10:40 ` Max Reitz
2020-04-23 22:17 ` [PATCH v2 3/3] qcow2: Tweak comment about bitmaps vs. resize Eric Blake
2020-04-24 10:41 ` Max Reitz
2020-04-23 22:28 ` [PATCH v2 0/3] qcow2: Allow resize of images with internal snapshots no-reply
2020-04-23 22:32 ` no-reply
2020-04-23 22:35 ` 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=307f7619-5e4a-10c1-7d49-8ee6bb8d650c@redhat.com \
--to=mreitz@redhat.com \
--cc=armbru@redhat.com \
--cc=codyprime@gmail.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=fam@euphon.net \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=namei.unix@gmail.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sheepdog@lists.wpkg.org \
--cc=stefanha@redhat.com \
--cc=sw@weilnetz.de \
/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).