qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/5] block: Avoid BlockDriverState.filename


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v3 2/5] block: Avoid BlockDriverState.filename
Date: Thu, 13 Aug 2015 16:59:56 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]