oslib: add a wrapper for mmap/munmap

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hbitmap: add hbitmap_copy

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hbitmap: add hbitmap_alloc_with_data and hbitmap_required_size

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: split bdrv_enable_dirty_tracking and bdrv_disable_dirty_tracking

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: support a persistent dirty bitmap

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
mirror: add support for persistent dirty bitmap

A persistent dirty bitmap lets mirroring proceed with no waste of work
after QEMU exits (either offline, or online when the VM restarts).
It is also useful in order to communicate to management whether the
switch to the destination was completed or not.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: choose the default dirty bitmap granularity in bdrv_enable_dirty_tracking

This is useful because we want the same logic in the monitor commands
that enable the persistent dirty bitmap.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
monitor: add commands to start/stop dirty bitmap

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: move flushing of persistent bitmap to the thread pool

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>