From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
qemu-block@nongnu.org, qemu-stable@nongnu.org, mreitz@redhat.com,
Stefan Hajnoczi <stefanha@redhat.com>,
jsnow@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/4] block: Guarantee that *file is set on bdrv_get_block_status()
Date: Wed, 24 May 2017 10:03:17 -0500 [thread overview]
Message-ID: <e40ef46c-4b13-bcc6-9385-99db3e384f41@redhat.com> (raw)
In-Reply-To: <20170519023233.24461-3-eblake@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]
On 05/18/2017 09:32 PM, Eric Blake wrote:
> We document that *file is valid if the return is not an error and
> includes BDRV_BLOCK_OFFSET_VALID, but forgot to obey this contract
> when a driver (such as blkdebug) lacks a callback. Broken in
> commit 67a0fd2 (v2.6), when we added the file parameter.
>
> +++ b/block/io.c
> @@ -1749,6 +1749,7 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
> int64_t n;
> int64_t ret, ret2;
>
> + *file = NULL;
> total_sectors = bdrv_nb_sectors(bs);
> if (total_sectors < 0) {
> return total_sectors;
> @@ -1769,6 +1770,7 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
> ret = BDRV_BLOCK_DATA | BDRV_BLOCK_ALLOCATED;
> if (bs->drv->protocol_name) {
> ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE);
> + *file = bs;
> }
> return ret;
> }
Continuing context:
*file = NULL;
ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors,
pnum,
file);
Guess I need a v2, to remove the now-redundant second initialization of
*file.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-05-24 15:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 2:32 [Qemu-devel] [PATCH 0/4] more blkdebug tweaks Eric Blake
2017-05-19 2:32 ` [Qemu-devel] [PATCH 1/4] qemu-io: Don't die on second open Eric Blake
2017-05-24 6:28 ` Fam Zheng
2017-05-24 13:43 ` Eric Blake
2017-05-19 2:32 ` [Qemu-devel] [PATCH 2/4] block: Guarantee that *file is set on bdrv_get_block_status() Eric Blake
2017-05-24 15:03 ` Eric Blake [this message]
2017-05-19 2:32 ` [Qemu-devel] [PATCH 3/4] block: Simplify use of BDRV_BLOCK_RAW Eric Blake
2017-05-22 20:23 ` Eric Blake
2017-05-19 2:32 ` [Qemu-devel] [PATCH 4/4] blkdebug: Support .bdrv_co_get_block_status Eric Blake
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=e40ef46c-4b13-bcc6-9385-99db3e384f41@redhat.com \
--to=eblake@redhat.com \
--cc=famz@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=qemu-stable@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 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.