
On 06/06/14 00:52, Eric Blake wrote:
As part of the work on backing chains, I'm finding that it would be easier to directly manipulate chains of pointers (adding a snapshot merely adjusts pointers to form the correct list) rather than copy data from one struct to another. This patch converts snapshot source to be a pointer.
In this patch, the pointer is ALWAYS allocated (any code that increases ndisks now also allocates a source pointer for each new disk), and all other changes are just mechanical fallout of the new type; there should be no functional change. It is possible that we may want to leave the pointer NULL for internal snapshots in a later patch, but as that requires a closer audit of the source to ensure we don't fault on a null dereference, I didn't do it here.
Agreed, that can be done later as it's really just a micro optimization.
* src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Change type of src. * src/conf/snapshot_conf.c: Adjust all clients. * src/qemu/qemu_conf.c: Likewise. * src/qemu/qemu_driver.c: Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com> --- src/conf/snapshot_conf.c | 56 +++++++++++++------------ src/conf/snapshot_conf.h | 2 +- src/qemu/qemu_conf.c | 2 +- src/qemu/qemu_driver.c | 104 +++++++++++++++++++++++------------------------ 4 files changed, 85 insertions(+), 79 deletions(-)
ACK. Peter