{"id":807893,"url":"http://patchwork.ozlabs.org/api/1.0/patches/807893/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20170830210542.2153-3-eblake@redhat.com>","date":"2017-08-30T21:05:26","name":"[v6,02/18] hbitmap: Rename serialization_granularity to serialization_align","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"f1fcfe815915892127bbfe7a93cc7436274a4351","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/1.0/people/6591/?format=json","name":"Eric Blake","email":"eblake@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830210542.2153-3-eblake@redhat.com/mbox/","series":[{"id":700,"url":"http://patchwork.ozlabs.org/api/1.0/series/700/?format=json","date":"2017-08-30T21:05:25","name":"make dirty-bitmap byte-based","version":6,"mbox":"http://patchwork.ozlabs.org/series/700/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807893/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjJ5j1S9Jz9s8P\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 07:08:57 +1000 (AEST)","from localhost ([::1]:52697 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dnAEJ-0005SE-5w\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 17:08:55 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:36811)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnABS-0003dJ-I7\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 17:05:59 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnABR-0007Lb-Aa\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 17:05:58 -0400","from mx1.redhat.com ([209.132.183.28]:43512)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>)\n\tid 1dnABO-0007HY-GR; Wed, 30 Aug 2017 17:05:54 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 8566B3DE3D;\n\tWed, 30 Aug 2017 21:05:53 +0000 (UTC)","from red.redhat.com (ovpn-122-186.rdu2.redhat.com [10.10.122.186])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 4FAE077557;\n\tWed, 30 Aug 2017 21:05:50 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 8566B3DE3D","From":"Eric Blake <eblake@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Wed, 30 Aug 2017 16:05:26 -0500","Message-Id":"<20170830210542.2153-3-eblake@redhat.com>","In-Reply-To":"<20170830210542.2153-1-eblake@redhat.com>","References":"<20170830210542.2153-1-eblake@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.29]);\n\tWed, 30 Aug 2017 21:05:53 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"[Qemu-devel] [PATCH v6 02/18] hbitmap: Rename\n\tserialization_granularity to serialization_align","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"kwolf@redhat.com, vsementsov@virtuozzo.com, Fam Zheng <famz@redhat.com>, \n\tqemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>, jsnow@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"The only client of hbitmap_serialization_granularity() is dirty-bitmap's\nbdrv_dirty_bitmap_serialization_align().  Keeping the two names consistent\nis worthwhile, and the shorter name is more representative of what the\nfunction returns (the required alignment to be used for start/count of\nother serialization functions, where violating the alignment causes\nassertion failures).\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\nReviewed-by: John Snow <jsnow@redhat.com>\n\n---\nv5: no change\nv4: new patch\n---\n include/qemu/hbitmap.h |  8 ++++----\n block/dirty-bitmap.c   |  2 +-\n tests/test-hbitmap.c   | 10 +++++-----\n util/hbitmap.c         |  8 ++++----\n 4 files changed, 14 insertions(+), 14 deletions(-)","diff":"diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h\nindex d3a74a21fc..81e78043d1 100644\n--- a/include/qemu/hbitmap.h\n+++ b/include/qemu/hbitmap.h\n@@ -159,16 +159,16 @@ bool hbitmap_get(const HBitmap *hb, uint64_t item);\n bool hbitmap_is_serializable(const HBitmap *hb);\n\n /**\n- * hbitmap_serialization_granularity:\n+ * hbitmap_serialization_align:\n  * @hb: HBitmap to operate on.\n  *\n- * Granularity of serialization chunks, used by other serialization functions.\n- * For every chunk:\n+ * Required alignment of serialization chunks, used by other serialization\n+ * functions. For every chunk:\n  * 1. Chunk start should be aligned to this granularity.\n  * 2. Chunk size should be aligned too, except for last chunk (for which\n  *      start + count == hb->size)\n  */\n-uint64_t hbitmap_serialization_granularity(const HBitmap *hb);\n+uint64_t hbitmap_serialization_align(const HBitmap *hb);\n\n /**\n  * hbitmap_serialization_size:\ndiff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c\nindex 30462d4f9a..0490ca3aff 100644\n--- a/block/dirty-bitmap.c\n+++ b/block/dirty-bitmap.c\n@@ -617,7 +617,7 @@ uint64_t bdrv_dirty_bitmap_serialization_size(const BdrvDirtyBitmap *bitmap,\n\n uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap *bitmap)\n {\n-    return hbitmap_serialization_granularity(bitmap->bitmap);\n+    return hbitmap_serialization_align(bitmap->bitmap);\n }\n\n void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap,\ndiff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c\nindex 1acb353889..af41642346 100644\n--- a/tests/test-hbitmap.c\n+++ b/tests/test-hbitmap.c\n@@ -738,15 +738,15 @@ static void test_hbitmap_meta_one(TestHBitmapData *data, const void *unused)\n     }\n }\n\n-static void test_hbitmap_serialize_granularity(TestHBitmapData *data,\n-                                               const void *unused)\n+static void test_hbitmap_serialize_align(TestHBitmapData *data,\n+                                         const void *unused)\n {\n     int r;\n\n     hbitmap_test_init(data, L3 * 2, 3);\n     g_assert(hbitmap_is_serializable(data->hb));\n\n-    r = hbitmap_serialization_granularity(data->hb);\n+    r = hbitmap_serialization_align(data->hb);\n     g_assert_cmpint(r, ==, 64 << 3);\n }\n\n@@ -974,8 +974,8 @@ int main(int argc, char **argv)\n     hbitmap_test_add(\"/hbitmap/meta/word\", test_hbitmap_meta_word);\n     hbitmap_test_add(\"/hbitmap/meta/sector\", test_hbitmap_meta_sector);\n\n-    hbitmap_test_add(\"/hbitmap/serialize/granularity\",\n-                     test_hbitmap_serialize_granularity);\n+    hbitmap_test_add(\"/hbitmap/serialize/align\",\n+                     test_hbitmap_serialize_align);\n     hbitmap_test_add(\"/hbitmap/serialize/basic\",\n                      test_hbitmap_serialize_basic);\n     hbitmap_test_add(\"/hbitmap/serialize/part\",\ndiff --git a/util/hbitmap.c b/util/hbitmap.c\nindex 21535cc90b..2f9d0fdbd0 100644\n--- a/util/hbitmap.c\n+++ b/util/hbitmap.c\n@@ -413,14 +413,14 @@ bool hbitmap_is_serializable(const HBitmap *hb)\n {\n     /* Every serialized chunk must be aligned to 64 bits so that endianness\n      * requirements can be fulfilled on both 64 bit and 32 bit hosts.\n-     * We have hbitmap_serialization_granularity() which converts this\n+     * We have hbitmap_serialization_align() which converts this\n      * alignment requirement from bitmap bits to items covered (e.g. sectors).\n      * That value is:\n      *    64 << hb->granularity\n      * Since this value must not exceed UINT64_MAX, hb->granularity must be\n      * less than 58 (== 64 - 6, where 6 is ld(64), i.e. 1 << 6 == 64).\n      *\n-     * In order for hbitmap_serialization_granularity() to always return a\n+     * In order for hbitmap_serialization_align() to always return a\n      * meaningful value, bitmaps that are to be serialized must have a\n      * granularity of less than 58. */\n\n@@ -437,7 +437,7 @@ bool hbitmap_get(const HBitmap *hb, uint64_t item)\n     return (hb->levels[HBITMAP_LEVELS - 1][pos >> BITS_PER_LEVEL] & bit) != 0;\n }\n\n-uint64_t hbitmap_serialization_granularity(const HBitmap *hb)\n+uint64_t hbitmap_serialization_align(const HBitmap *hb)\n {\n     assert(hbitmap_is_serializable(hb));\n\n@@ -454,7 +454,7 @@ static void serialization_chunk(const HBitmap *hb,\n                                 unsigned long **first_el, uint64_t *el_count)\n {\n     uint64_t last = start + count - 1;\n-    uint64_t gran = hbitmap_serialization_granularity(hb);\n+    uint64_t gran = hbitmap_serialization_align(hb);\n\n     assert((start & (gran - 1)) == 0);\n     assert((last >> hb->granularity) < hb->size);\n","prefixes":["v6","02/18"]}