All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, armbru@redhat.com, eblake@redhat.com,
	jsnow@redhat.com, famz@redhat.com, den@openvz.org,
	stefanha@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH 21/21] qcow2-bitmap: refcounts
Date: Wed, 14 Dec 2016 11:27:44 +0100	[thread overview]
Message-ID: <07824e01-e163-c1eb-101b-5e7e27d701d9@redhat.com> (raw)
In-Reply-To: <1479835586-74394-22-git-send-email-vsementsov@virtuozzo.com>

On 2016-11-22 at 18:26, Vladimir Sementsov-Ogievskiy wrote:
> Calculate refcounts for qcow2 bitmaps. It is needed for qcow2's qemu-img
> check implementation.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  block/qcow2-bitmap.c   | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  block/qcow2-refcount.c |  6 +++++
>  block/qcow2.h          |  3 +++
>  3 files changed, 82 insertions(+)
>
> diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
> index 55b1112..0e0ddf3 100644
> --- a/block/qcow2-bitmap.c
> +++ b/block/qcow2-bitmap.c
> @@ -1155,3 +1155,76 @@ common_errp:
>                 name, bdrv_get_device_or_node_name(bs), reason);
>      return false;
>  }
> +
> +int qcow2_check_bitmaps_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
> +                                  void **refcount_table,
> +                                  int64_t *refcount_table_size)
> +{

[...]

> +        for (i = 0; i < bm->table_size; ++i) {
> +            uint64_t entry = bitmap_table[i];
> +            uint64_t offset = entry & BME_TABLE_ENTRY_OFFSET_MASK;
> +
> +            if (check_table_entry(entry, s->cluster_size) < 0) {
> +                res->corruptions++;
> +                ret = -EINVAL;
> +                continue;

First an optional suggestion: You could just assign 
check_table_entry()'s return value directly to ret, then you wouldn't 
have to set it manually.

Second, why are you setting ret at all? If any of the next iterations is 
successful, it will get overwritten and be set to 0 again.

Max

> +            }
> +
> +            if (offset == 0) {
> +                continue;
> +            }
> +
> +            ret = qcow2_inc_refcounts_imrt(bs, res,
> +                                           refcount_table, refcount_table_size,
> +                                           offset, s->cluster_size);
> +            if (ret < 0) {
> +                g_free(bitmap_table);
> +                goto out;
> +            }
> +        }
> +
> +        g_free(bitmap_table);
> +    }
> +
> +out:
> +    bitmap_list_free(bm_list);
> +
> +    return ret;
> +}

  reply	other threads:[~2016-12-14 10:27 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 17:26 [Qemu-devel] [PATCH v9 00/21] qcow2: persistent dirty bitmaps Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 01/21] specs/qcow2: fix bitmap granularity qemu-specific note Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 02/21] specs/qcow2: do not use wording 'bitmap header' Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 03/21] hbitmap: improve dirty iter Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 04/21] tests: add hbitmap iter test Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 05/21] block: fix bdrv_dirty_bitmap_granularity signature Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 06/21] block/dirty-bitmap: add deserialize_ones func Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 07/21] qcow2: add bitmaps extension Vladimir Sementsov-Ogievskiy
2016-12-07 18:25   ` Max Reitz
2016-12-14 12:23     ` Vladimir Sementsov-Ogievskiy
2016-12-16 14:25       ` Max Reitz
2016-12-21 10:09         ` Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 08/21] block: introduce auto-loading bitmaps Vladimir Sementsov-Ogievskiy
2016-12-07 18:34   ` Max Reitz
2016-12-07 22:51   ` John Snow
2016-11-22 17:26 ` [Qemu-devel] [PATCH 09/21] qcow2: add .bdrv_load_autoloading_dirty_bitmaps Vladimir Sementsov-Ogievskiy
2016-12-07 20:51   ` Max Reitz
2016-12-14 15:54     ` Vladimir Sementsov-Ogievskiy
2016-12-16 14:37       ` Max Reitz
2016-12-19 11:54         ` Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 10/21] block/dirty-bitmap: add autoload field to BdrvDirtyBitmap Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 11/21] block: introduce persistent dirty bitmaps Vladimir Sementsov-Ogievskiy
2016-12-07 21:01   ` Max Reitz
2016-11-22 17:26 ` [Qemu-devel] [PATCH 12/21] block/dirty-bitmap: add bdrv_dirty_bitmap_next() Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 13/21] qcow2: add .bdrv_store_persistent_dirty_bitmaps() Vladimir Sementsov-Ogievskiy
2016-12-09 17:05   ` Max Reitz
2016-12-09 17:55     ` Vladimir Sementsov-Ogievskiy
2016-12-10 14:53       ` Max Reitz
2016-12-12  7:32         ` Vladimir Sementsov-Ogievskiy
2016-12-17 14:58     ` Vladimir Sementsov-Ogievskiy
2016-12-19 15:14       ` Max Reitz
2016-12-19 15:26         ` Vladimir Sementsov-Ogievskiy
2016-12-19 15:34           ` Max Reitz
2016-12-19 15:50             ` Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 14/21] block: add bdrv_can_store_dirty_bitmap Vladimir Sementsov-Ogievskiy
2016-12-09 17:12   ` Max Reitz
2016-11-22 17:26 ` [Qemu-devel] [PATCH 15/21] qcow2: add .bdrv_can_store_dirty_bitmap Vladimir Sementsov-Ogievskiy
2016-12-09 17:28   ` Max Reitz
2016-12-09 18:03     ` Vladimir Sementsov-Ogievskiy
2016-11-22 17:26 ` [Qemu-devel] [PATCH 16/21] qmp: add persistent flag to block-dirty-bitmap-add Vladimir Sementsov-Ogievskiy
2016-12-07 18:48   ` Eric Blake
2016-12-09 17:36   ` Max Reitz
2016-11-22 17:26 ` [Qemu-devel] [PATCH 17/21] qmp: add autoload parameter " Vladimir Sementsov-Ogievskiy
2016-12-09 17:55   ` Max Reitz
2016-11-22 17:26 ` [Qemu-devel] [PATCH 18/21] qmp: add x-debug-block-dirty-bitmap-sha256 Vladimir Sementsov-Ogievskiy
2016-12-13 16:09   ` Max Reitz
2016-11-22 17:26 ` [Qemu-devel] [PATCH 19/21] iotests: test qcow2 persistent dirty bitmap Vladimir Sementsov-Ogievskiy
2016-12-14  9:27   ` Max Reitz
2016-11-22 17:26 ` [Qemu-devel] [PATCH 20/21] qcow2-refcount: rename inc_refcounts() and make it public Vladimir Sementsov-Ogievskiy
2016-12-14 10:00   ` Max Reitz
2016-11-22 17:26 ` [Qemu-devel] [PATCH 21/21] qcow2-bitmap: refcounts Vladimir Sementsov-Ogievskiy
2016-12-14 10:27   ` Max Reitz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-11-09 18:17 [Qemu-devel] [PATCH v8 00/21] qcow2: persistent dirty bitmaps Vladimir Sementsov-Ogievskiy
2016-11-09 18:17 ` [Qemu-devel] [PATCH 21/21] qcow2-bitmap: refcounts Vladimir Sementsov-Ogievskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07824e01-e163-c1eb-101b-5e7e27d701d9@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=famz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.