[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] qcow2: Support for fixing refcount inconsis
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] qcow2: Support for fixing refcount inconsistencies |
Date: |
Fri, 25 May 2012 16:33:18 +0100 |
On Fri, May 11, 2012 at 5:48 PM, Kevin Wolf <address@hidden> wrote:
> @@ -1205,9 +1206,31 @@ int qcow2_check_refcounts(BlockDriverState *bs,
> BdrvCheckResult *res)
>
> refcount2 = refcount_table[i];
> if (refcount1 != refcount2) {
> +
> + /* Check if we're allowed to fix the mismatch */
> + int *num_fixed = NULL;
> + if (refcount1 > refcount2 && (fix & BDRV_FIX_LEAKS)) {
> + num_fixed = &res->leaks_fixed;
> + } else if (refcount1 < refcount2 && (fix & BDRV_FIX_ERRORS)) {
> + num_fixed = &res->corruptions_fixed;
> + }
> +
> fprintf(stderr, "%s cluster %d refcount=%d reference=%d\n",
> - refcount1 < refcount2 ? "ERROR" : "Leaked",
> + num_fixed != NULL ? "Repairing" :
> + refcount1 < refcount2 ? "ERROR" :
> + "Leaked",
> i, refcount1, refcount2);
> +
> + if (num_fixed) {
> + ret = update_refcount(bs, i << s->cluster_bits, 1,
> + refcount2 - refcount1);
It would be nicer to use int64_t for i. I haven't checked but it
makes me nervous to shift ints here.
Stefan
- [Qemu-devel] [PATCH block-next 0/3] qemu-img check/qcow2: Allow fixing refcounts, Kevin Wolf, 2012/05/11
- [Qemu-devel] [PATCH 3/3] qcow2: Support for fixing refcount inconsistencies, Kevin Wolf, 2012/05/11
- Re: [Qemu-devel] [PATCH 3/3] qcow2: Support for fixing refcount inconsistencies,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 2/3] qemu-img check: Print fixed clusters and recheck, Kevin Wolf, 2012/05/11
- [Qemu-devel] [PATCH 1/3] qemu-img check -r for repairing images, Kevin Wolf, 2012/05/11
- Re: [Qemu-devel] [PATCH block-next 0/3] qemu-img check/qcow2: Allow fixing refcounts, Stefan Hajnoczi, 2012/05/25
- Re: [Qemu-devel] [PATCH block-next 0/3] qemu-img check/qcow2: Allow fixing refcounts, Zhi Yong Wu, 2012/05/30