qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 2/5] block: Avoid BlockDriverState.filename
Date: Thu, 13 Aug 2015 16:59:56 +0200	[thread overview]
Message-ID: <20150813145956.GD6922@noname.redhat.com> (raw)
In-Reply-To: <1439394502-23619-3-git-send-email-mreitz@redhat.com>

Am 12.08.2015 um 17:48 hat Max Reitz geschrieben:
> In places which directly pass a filename to the OS, we should not use
> the filename field at all but exact_filename instead (although the
> former currently equals the latter if that is set).
> 
> In qemu-img's map command, we should be using the filename field; but
> since this commit prepares to remove that field, using exact_filename is
> fine, too (this is the only user of BlockDriverState.filename which
> frequently queries that field).
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>

> diff --git a/qemu-img.c b/qemu-img.c
> index 75f4ee4..3d5587a 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -2155,7 +2155,7 @@ static void dump_map_entry(OutputFormat output_format, MapEntry *e,
>          }
>          if ((e->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) == BDRV_BLOCK_DATA) {
>              printf("%#-16"PRIx64"%#-16"PRIx64"%#-16"PRIx64"%s\n",
> -                   e->start, e->length, e->offset, e->bs->filename);
> +                   e->start, e->length, e->offset, e->bs->exact_filename);
>          }
>          /* This format ignores the distinction between 0, ZERO and ZERO|DATA.
>           * Modify the flags here to allow more coalescing.

Before this patch:

$ ./qemu-img map 'json:{"driver":"blkdebug","align":512,"image":{"filename":"/tmp/test.qcow2"}}'
Offset          Length          Mapped to       File
0               0x15d100000     0               json:{"image": {"driver": "file", "filename": "/tmp/test.qcow2"}, "driver": "blkdebug", "align": 512}

After the patch:

$ ./qemu-img map 'json:{"driver":"blkdebug","align":512,"image":{"filename":"/tmp/test.qcow2"}}'
Offset          Length          Mapped to       File
0               0x15d100000     0              

I don't think we can use bs->exact_filename here.

Kevin

  reply	other threads:[~2015-08-13 15:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 15:48 [Qemu-devel] [PATCH v3 0/5] block: Drop BDS.filename Max Reitz
2015-08-12 15:48 ` [Qemu-devel] [PATCH v3 1/5] block: Change bdrv_get_encrypted_filename() Max Reitz
2015-08-12 15:48 ` [Qemu-devel] [PATCH v3 2/5] block: Avoid BlockDriverState.filename Max Reitz
2015-08-13 14:59   ` Kevin Wolf [this message]
2015-08-12 15:48 ` [Qemu-devel] [PATCH v3 3/5] block: Add bdrv_filename() Max Reitz
2015-08-12 15:48 ` [Qemu-devel] [PATCH v3 4/5] block: Drop BlockDriverState.filename Max Reitz
2015-08-13 15:28   ` Kevin Wolf
2015-08-12 15:48 ` [Qemu-devel] [PATCH v3 5/5] iotests: Test changed Quorum filename Max Reitz
2015-08-13 15:30 ` [Qemu-devel] [PATCH v3 0/5] block: Drop BDS.filename 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=20150813145956.GD6922@noname.redhat.com \
    --to=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --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).