qcow2: Let vmstate call qcow2_co_preadv/pwrite directly
commit734a77584ae13d36113a7a7cd8b54beb49a8a48e
authorKevin Wolf <kwolf@redhat.com>
Wed, 1 Jun 2016 15:07:24 +0000 (1 17:07 +0200)
committerKevin Wolf <kwolf@redhat.com>
Thu, 16 Jun 2016 13:19:56 +0000 (16 15:19 +0200)
tree374d64bfd3d040c5247dbaec21dba4804382d36a
parent1a8ae8221799901dc399a174b52a970d8e6f976a
qcow2: Let vmstate call qcow2_co_preadv/pwrite directly

We don't really want to go through the block layer in order to read from
or write to the vmstate in a qcow2 image. Doing so required a few ugly
hacks like saving and restoring the old image size (because writing to
vmstate offsets would increase the image size) or disabling the "reads
after EOF = zeroes" logic. When calling the right functions directly,
these hacks aren't necessary any more.

Note that .bdrv_vmstate_load/save() return 0 instead of the number of
bytes in case of success now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
block/qcow2.c