[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-devel] [PATCH] Teach block/vdi about "discarded
Re: [Qemu-trivial] [Qemu-devel] [PATCH] Teach block/vdi about "discarded" (no longer allocated) blocks
Thu, 27 Oct 2011 12:20:15 -0400
On Oct 27, 2011, at 12:12 PM, Stefan Weil wrote:
Am 27.10.2011 10:53, schrieb Kevin Wolf:
Am 26.10.2011 21:51, schrieb Eric Sunshine:
An entry in the VDI block map will hold an offset to the actual
the block is allocated, or one of two specially-interpreted values
not allocated. Using VirtualBox terminology, value
(0xffffffff) represents a never-allocated block (semantically
content). VDI_IMAGE_BLOCK_ZERO (0xfffffffe) represents a "discarded"
block (semantically zero-filled). block/vdi knows only about
VDI_IMAGE_BLOCK_FREE. Teach it about VDI_IMAGE_BLOCK_ZERO.
Signed-off-by: Eric Sunshine <address@hidden>
Thanks, applied to the block branch.
Kevin, I don't want to block improvements. Nevertheless
I'd like to see a small modification in this patch:
both #defines should be implemented without a type cast.
Please change them or wait until Eric sends an update.
My favorite is this:
#define VDI_UNALLOCATED UINT32_MAX
#define VDI_DISCARD (VDI_UNALLOCATED - 1)
This would also be ok:
#define VDI_UNALLOCATED 0xffffffffU
#define VDI_DISCARD 0xfffffffeU
Using the macro names and the definitions (with type cast)
from the original VirtualBox code would also be ok.
I originally implemented the change using the macro names, comments,
and definitions from the VirtualBox code, but found that it made the
diff so noisy that it obscured the simpler underlying change of
teaching block/vdi about "discarded" blocks. Sticking with the
original VDI_UNALLOCATED macro name kept the diff noise level down.
At any rate, if Kevin can amend the commit with one of your above
suggestions, that would be simplest. Otherwise, I can re-roll. Let me
know which is preferred.