|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-devel] [PATCH v5 12/21] block: define get_block_status return value |
Date: | Tue, 06 May 2014 15:20:42 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
Il 06/05/2014 15:08, Kevin Wolf ha scritto:
This is true, because bdrv_get_block_status does not ask the backing file whether it is zero in the backing file. Thus, reading from the backing file does not guarantee to read zeroes.Aha, this paragraph is the key. :-) I assumed that bdrv_get_block_status() does ask the backing file, but apparently it doesn't. The current meaning of BDRV_BLOCK_ZERO is therefore not simply "sectors read as zero", but "sectors read as zero and this is determined by bs itself (mostly, except for the backing file size)".
Exactly.
Is it a good idea to rely on this or would it be reasonable for bdrv_get_block_status() to look at the backing file for returning ZERO sometime in the future? I think that could be useful information in some cases.
It is reasonable, for example SCSI emulation could use it. However, it would be a different API (like bdrv_is_allocated_above). It would be very similar to get_block_status() in qemu-img.c.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |