Il 24/05/2012 16:00, Ori Mamluk ha scritto:
The dirty bitmap is managed by these QMP commands:
* blockdev-dirty-enable: takes a file name used for the dirty bitmap,
and an optional granularity. Setting the granularity will not be
supported in the initial version.
* query-block-dirty: returns statistics about the dirty bitmap: right
now the granularity, the number of bits that are set, and whether QEMU
is using the dirty bitmap or just adding to it.
* blockdev-dirty-disable: disable the dirty bitmap.
When do bits get cleared from the bitmap?
drive-mirror clears bits from the bitmap as it processes the writes.
In addition to the persistent dirty bitmap, QEMU keeps an in-flight
bitmap. The in-flight bitmap does not need to be persistent.
Here is how the bitmaps are handled when doing I/O on the source:
- after writing to the source:
- clear bit in the volatile in-flight bitmap
- set bit in the persistent dirty bitmap
- after flushing the source:
- msync the persistent bitmap to disk
Here is how the bitmaps are handled in the drive-mirror coroutine:
- before reading from the source:
- set bit in the volatile in-flight bitmap
- after writing to the target:
- if the dirty count will become zero, flush the target
- if the bit is still set in the in-flight bitmap, clear bit in the
persistent dirty bitmap
- clear bit in the volatile in-flight bitmap