* [Qemu-devel] about qemu-img info on block dev
@ 2017-11-07 7:18 wang.guang55
2017-11-07 9:15 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: wang.guang55 @ 2017-11-07 7:18 UTC (permalink / raw)
To: kwolf, mreitz; +Cc: qemu-block, qemu-devel, wang.yong155
hello
if we create a qcow2 file on a block dev.
we can,t get the right disk size by qemu-img info。
[root@host-120-79 qemu]# ./qemu-img create -f qcow2 /dev/zs/lvol0 1G
Formatting '/dev/zs/lvol0', fmt=qcow2 size=1073741824 cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@host-120-79 qemu]# ./qemu-img info /dev/zs/lvol0
image: /dev/zs/lvol0
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 0
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
Then we get disk size from L1 table and L2 table in qcow2_get_allocated_file_size.
May be we can submit the patch to qemu master??
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] about qemu-img info on block dev
2017-11-07 7:18 [Qemu-devel] about qemu-img info on block dev wang.guang55
@ 2017-11-07 9:15 ` Kevin Wolf
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2017-11-07 9:15 UTC (permalink / raw)
To: wang.guang55; +Cc: mreitz, qemu-block, qemu-devel, wang.yong155
Am 07.11.2017 um 08:18 hat wang.guang55@zte.com.cn geschrieben:
> hello
>
>
> if we create a qcow2 file on a block dev.
>
>
> we can,t get the right disk size by qemu-img info。
>
>
>
>
>
>
> [root@host-120-79 qemu]# ./qemu-img create -f qcow2 /dev/zs/lvol0 1G
>
> Formatting '/dev/zs/lvol0', fmt=qcow2 size=1073741824 cluster_size=65536 lazy_refcounts=off refcount_bits=16
>
> [root@host-120-79 qemu]# ./qemu-img info /dev/zs/lvol0
>
> image: /dev/zs/lvol0
>
> file format: qcow2
>
> virtual size: 1.0G (1073741824 bytes)
>
> disk size: 0
>
> cluster_size: 65536
>
> Format specific information:
>
> compat: 1.1
>
> lazy refcounts: false
>
> refcount bits: 16
>
> corrupt: false
>
>
>
>
>
>
> Then we get disk size from L1 table and L2 table in qcow2_get_allocated_file_size.
>
>
> May be we can submit the patch to qemu master??
No, qcow2 is the wrong layer to do this. If anything,
raw_get_allocated_file_size() could be changed to return the full file
size for block devices. However, even this is not necessarily the right
number, the block device could actually be thin provisioned and the
kernel doesn't tell us how many blocks are actually allocated. So I
think 0 for "we don't know" is in fact the right answer.
Kevin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-07 9:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-07 7:18 [Qemu-devel] about qemu-img info on block dev wang.guang55
2017-11-07 9:15 ` Kevin Wolf
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.