A prerequisite for a "QED mode" in qcow2, which doesn't update the refcount table except on clean shutdown, is that refcounts can be repaired when the image is opened the next time after a crash.
This series adds a qemu-img check option that doesn't only check, but also tries to fix the errors that it found. Kevin Wolf (3): qemu-img check -r for repairing images qemu-img check: Print fixed clusters and recheck qcow2: Support for fixing refcount inconsistencies block.c | 4 ++-- block.h | 9 ++++++++- block/qcow2-refcount.c | 27 +++++++++++++++++++++++++-- block/qcow2.c | 5 +++-- block/qcow2.h | 3 ++- block/qed-check.c | 2 ++ block/qed.c | 5 +++-- block/vdi.c | 7 ++++++- block_int.h | 3 ++- qemu-img-cmds.hx | 4 ++-- qemu-img.c | 35 ++++++++++++++++++++++++++++++++--- qemu-img.texi | 7 ++++++- 12 files changed, 93 insertions(+), 18 deletions(-) -- 1.7.6.5