All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 1/3] block: Introduce BDRV_O_NO_BACKING
Date: Wed, 13 Jan 2010 17:26:31 -0600	[thread overview]
Message-ID: <4B4E56A7.4040901@codemonkey.ws> (raw)
In-Reply-To: <1263297318-10912-2-git-send-email-kwolf@redhat.com>

On 01/12/2010 05:55 AM, Kevin Wolf wrote:
> If an image references a backing file that doesn't exist, qemu-img info fails
> to open this image. Exactly in this case the info would be valuable, though:
> the user might want to find out which file is missing.
>
> This patch introduces a BDRV_O_NO_BACKING flag to ignore the backing file when
> opening the image. qemu-img info is the first user and provides info now even
> if the backing file is invalid.
>
> Signed-off-by: Kevin Wolf<kwolf@redhat.com>
>    

Applied all.  Thanks.

Regards,

Anthony Liguori
> ---
>   block.c    |    4 ++--
>   block.h    |    1 +
>   qemu-img.c |    2 +-
>   3 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/block.c b/block.c
> index 30ae2b1..994109e 100644
> --- a/block.c
> +++ b/block.c
> @@ -477,7 +477,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
>           unlink(filename);
>       }
>   #endif
> -    if (bs->backing_file[0] != '\0') {
> +    if ((flags&  BDRV_O_NO_BACKING) == 0&&  bs->backing_file[0] != '\0') {
>           /* if there is a backing file, use it */
>           BlockDriver *back_drv = NULL;
>           bs->backing_hd = bdrv_new("");
> @@ -1352,7 +1352,7 @@ const char *bdrv_get_encrypted_filename(BlockDriverState *bs)
>   void bdrv_get_backing_filename(BlockDriverState *bs,
>                                  char *filename, int filename_size)
>   {
> -    if (!bs->backing_hd) {
> +    if (!bs->backing_file) {
>           pstrcpy(filename, filename_size, "");
>       } else {
>           pstrcpy(filename, filename_size, bs->backing_file);
> diff --git a/block.h b/block.h
> index fa51ddf..f660d5f 100644
> --- a/block.h
> +++ b/block.h
> @@ -39,6 +39,7 @@ typedef struct QEMUSnapshotInfo {
>   #define BDRV_O_NOCACHE     0x0020 /* do not use the host page cache */
>   #define BDRV_O_CACHE_WB    0x0040 /* use write-back caching */
>   #define BDRV_O_NATIVE_AIO  0x0080 /* use native AIO instead of the thread pool */
> +#define BDRV_O_NO_BACKING  0x0100 /* don't open the backing file */
>
>   #define BDRV_O_CACHE_MASK  (BDRV_O_NOCACHE | BDRV_O_CACHE_WB)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index 1d97f2e..5ad88bf 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -884,7 +884,7 @@ static int img_info(int argc, char **argv)
>       } else {
>           drv = NULL;
>       }
> -    if (bdrv_open2(bs, filename, BRDV_O_FLAGS, drv)<  0) {
> +    if (bdrv_open2(bs, filename, BRDV_O_FLAGS | BDRV_O_NO_BACKING, drv)<  0) {
>           error("Could not open '%s'", filename);
>       }
>       bdrv_get_format(bs, fmt_name, sizeof(fmt_name));
>    

  reply	other threads:[~2010-01-13 23:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-12 11:55 [Qemu-devel] [PATCH v4 0/3] Change the backing file of images Kevin Wolf
2010-01-12 11:55 ` [Qemu-devel] [PATCH v4 1/3] block: Introduce BDRV_O_NO_BACKING Kevin Wolf
2010-01-13 23:26   ` Anthony Liguori [this message]
2010-01-12 11:55 ` [Qemu-devel] [PATCH v4 2/3] block: Add bdrv_change_backing_file Kevin Wolf
2010-01-12 11:55 ` [Qemu-devel] [PATCH v4 3/3] qemu-img rebase 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=4B4E56A7.4040901@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=kwolf@redhat.com \
    --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 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.