All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Different type of qcow2_get_cluster_type
@ 2018-09-14  8:35 lampahome
  2018-09-14 14:59 ` Eric Blake
  0 siblings, 1 reply; 2+ messages in thread
From: lampahome @ 2018-09-14  8:35 UTC (permalink / raw)
  To: QEMU Developers

The function qcow2_get_cluster_type() is in /block/qcow2.h
It will return the flage based on the entry.

There're some flags confused me.
What's difference between QCOW2_CLUSTER_ZERO_ALLOC &
QCOW2_CLUSTER_ZERO_PLAIN
in there?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] Different type of qcow2_get_cluster_type
  2018-09-14  8:35 [Qemu-devel] Different type of qcow2_get_cluster_type lampahome
@ 2018-09-14 14:59 ` Eric Blake
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2018-09-14 14:59 UTC (permalink / raw)
  To: lampahome, QEMU Developers

On 9/14/18 3:35 AM, lampahome wrote:
> The function qcow2_get_cluster_type() is in /block/qcow2.h
> It will return the flage based on the entry.
> 
> There're some flags confused me.
> What's difference between QCOW2_CLUSTER_ZERO_ALLOC &
> QCOW2_CLUSTER_ZERO_PLAIN
> in there?

Look at docs/interop/qcow2.txt at the L2 entry format:

Bit 0: If set to 1, the cluster reads as all zeros
Bits 9-55: Bits 9-55 of host cluster offset; if 0 the cluster is unallocated

Both values correspond to L2 entries with bit 0 set.  However, 
QCOW2_CLUSTER_ZERO_ALLOC is an entry that has a non-zero value in bits 
9-55 (the cluster has an allocated host location, we guarantee that 
things read as zero regardless of whether the host data actually 
contains zeroes at that offset, and writes go directly to that offset 
with no further allocation required); while QCOW2_CLUSTER_ZERO_PLAIN is 
an entry with all zeros in bits 9-55 (we guarantee things read as zero, 
but writes have to allocate a new cluster because we have not reserved 
any space in the host yet).

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-14 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-14  8:35 [Qemu-devel] Different type of qcow2_get_cluster_type lampahome
2018-09-14 14:59 ` Eric Blake

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.