On 2/19/21 10:42 AM, Eric Blake wrote: >> To me, data=false looks compatible with NBD_STATE_HOLE. From user point >> of view, getting same results from qemu-nbd and qemu-img is more >> important than being more correct about allocation status. > > More to the point, here is our inconsistency: > > In nbd/server.c, we turn !BDRV_BLOCK_ALLOCATED into NBD_STATE_HOLE > > In block/nbd.c, we turn !NBD_STATE_HOLE into BDRV_BLOCK_DATA > > The fact that we are not doing a round-trip conversion means that one of > the two places is wrong. And your argument that the server side is > wrong makes sense to me.
In fact, when I went back and researched when this was introduced (see commit e7b1948d51 in 2018), we may have been aware of the inconsistency between client and server, but didn't make up our minds at the time: https://lists.gnu.org/archive/html/qemu-devel/2018-03/msg03465.html "? Hm, don't remember, what we decided about DATA/HOLE flags mapping.." > > I'll wait a few days for any other reviewer commentary before taking > this through my NBD tree. > -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org