Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/813518/?format=api
{ "id": 813518, "url": "http://patchwork.ozlabs.org/api/patches/813518/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170913160333.23622-4-eblake@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "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": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170913160333.23622-4-eblake@redhat.com>", "list_archive_url": null, "date": "2017-09-13T16:03:13", "name": "[v4,03/23] block: Make bdrv_round_to_clusters() signature more useful", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "6b96288c209f992ae66ef21845108d55155243ec", "submitter": { "id": 6591, "url": "http://patchwork.ozlabs.org/api/people/6591/?format=api", "name": "Eric Blake", "email": "eblake@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170913160333.23622-4-eblake@redhat.com/mbox/", "series": [ { "id": 2944, "url": "http://patchwork.ozlabs.org/api/series/2944/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2944", "date": "2017-09-13T16:03:10", "name": "make bdrv_get_block_status byte-based", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/2944/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/813518/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/813518/checks/", "tags": {}, "related": [], "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=208.118.235.17; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [208.118.235.17])\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 3xsmwj6wtHz9s72\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 02:15:32 +1000 (AEST)", "from localhost ([::1]:43408 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 1dsAK2-0005p4-Mw\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 12:15:30 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:45523)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dsA8w-0001AL-Eu\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 12:04:08 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dsA8q-0005n0-J0\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 12:04:02 -0400", "from mx1.redhat.com ([209.132.183.28]:49758)\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 1dsA8m-0005in-HQ; Wed, 13 Sep 2017 12:03:52 -0400", "from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\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 9B0B15D687;\n\tWed, 13 Sep 2017 16:03:51 +0000 (UTC)", "from red.redhat.com (ovpn-120-201.rdu2.redhat.com [10.10.120.201])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id C3F6A5C6D2;\n\tWed, 13 Sep 2017 16:03:47 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 9B0B15D687", "From": "Eric Blake <eblake@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Wed, 13 Sep 2017 11:03:13 -0500", "Message-Id": "<20170913160333.23622-4-eblake@redhat.com>", "In-Reply-To": "<20170913160333.23622-1-eblake@redhat.com>", "References": "<20170913160333.23622-1-eblake@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.11", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tWed, 13 Sep 2017 16:03:51 +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 v4 03/23] block: Make bdrv_round_to_clusters()\n\tsignature more useful", "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, famz@redhat.com, qemu-block@nongnu.org,\n\tJeff Cody <jcody@redhat.com>, Max Reitz <mreitz@redhat.com>,\n\tStefan Hajnoczi <stefanha@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": "In the process of converting sector-based interfaces to bytes,\nI'm finding it easier to represent a byte count as a 64-bit\ninteger at the block layer (even if we are internally capped\nby SIZE_MAX or even INT_MAX for individual transactions, it's\nstill nicer to not have to worry about truncation/overflow\nissues on as many variables). Update the signature of\nbdrv_round_to_clusters() to uniformly use int64_t, matching\nthe signature already chosen for bdrv_is_allocated and the\nfact that off_t is also a signed type, then adjust clients\naccording to the required fallout.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\nReviewed-by: Fam Zheng <famz@redhat.com>\n\n---\nv4: only context changes\nv3: no change\nv2: fix commit message [John], rebase to earlier changes, including\nmirror_clip_bytes() signature update\n---\n include/block/block.h | 4 ++--\n block/io.c | 7 ++++---\n block/mirror.c | 7 +++----\n block/trace-events | 2 +-\n 4 files changed, 10 insertions(+), 10 deletions(-)", "diff": "diff --git a/include/block/block.h b/include/block/block.h\nindex 2ad18775af..bb3b95d491 100644\n--- a/include/block/block.h\n+++ b/include/block/block.h\n@@ -475,9 +475,9 @@ int bdrv_get_flags(BlockDriverState *bs);\n int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi);\n ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs);\n void bdrv_round_to_clusters(BlockDriverState *bs,\n- int64_t offset, unsigned int bytes,\n+ int64_t offset, int64_t bytes,\n int64_t *cluster_offset,\n- unsigned int *cluster_bytes);\n+ int64_t *cluster_bytes);\n\n const char *bdrv_get_encrypted_filename(BlockDriverState *bs);\n void bdrv_get_backing_filename(BlockDriverState *bs,\ndiff --git a/block/io.c b/block/io.c\nindex 6509c804d4..b362b46e3d 100644\n--- a/block/io.c\n+++ b/block/io.c\n@@ -446,9 +446,9 @@ static void mark_request_serialising(BdrvTrackedRequest *req, uint64_t align)\n * Round a region to cluster boundaries\n */\n void bdrv_round_to_clusters(BlockDriverState *bs,\n- int64_t offset, unsigned int bytes,\n+ int64_t offset, int64_t bytes,\n int64_t *cluster_offset,\n- unsigned int *cluster_bytes)\n+ int64_t *cluster_bytes)\n {\n BlockDriverInfo bdi;\n\n@@ -946,7 +946,7 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child,\n struct iovec iov;\n QEMUIOVector bounce_qiov;\n int64_t cluster_offset;\n- unsigned int cluster_bytes;\n+ int64_t cluster_bytes;\n size_t skip_bytes;\n int ret;\n\n@@ -967,6 +967,7 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child,\n trace_bdrv_co_do_copy_on_readv(bs, offset, bytes,\n cluster_offset, cluster_bytes);\n\n+ assert(cluster_bytes < SIZE_MAX);\n iov.iov_len = cluster_bytes;\n iov.iov_base = bounce_buffer = qemu_try_blockalign(bs, iov.iov_len);\n if (bounce_buffer == NULL) {\ndiff --git a/block/mirror.c b/block/mirror.c\nindex 032cfe91fa..67f45cec4e 100644\n--- a/block/mirror.c\n+++ b/block/mirror.c\n@@ -190,10 +190,9 @@ static int mirror_cow_align(MirrorBlockJob *s, int64_t *offset,\n bool need_cow;\n int ret = 0;\n int64_t align_offset = *offset;\n- unsigned int align_bytes = *bytes;\n+ int64_t align_bytes = *bytes;\n int max_bytes = s->granularity * s->max_iov;\n\n- assert(*bytes < INT_MAX);\n need_cow = !test_bit(*offset / s->granularity, s->cow_bitmap);\n need_cow |= !test_bit((*offset + *bytes - 1) / s->granularity,\n s->cow_bitmap);\n@@ -388,7 +387,7 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)\n while (nb_chunks > 0 && offset < s->bdev_length) {\n int64_t ret;\n int io_sectors;\n- unsigned int io_bytes;\n+ int64_t io_bytes;\n int64_t io_bytes_acct;\n enum MirrorMethod {\n MIRROR_METHOD_COPY,\n@@ -413,7 +412,7 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)\n io_bytes = s->granularity;\n } else if (ret >= 0 && !(ret & BDRV_BLOCK_DATA)) {\n int64_t target_offset;\n- unsigned int target_bytes;\n+ int64_t target_bytes;\n bdrv_round_to_clusters(blk_bs(s->target), offset, io_bytes,\n &target_offset, &target_bytes);\n if (target_offset == offset &&\ndiff --git a/block/trace-events b/block/trace-events\nindex 25dd5a3026..4c6586f156 100644\n--- a/block/trace-events\n+++ b/block/trace-events\n@@ -12,7 +12,7 @@ blk_co_pwritev(void *blk, void *bs, int64_t offset, unsigned int bytes, int flag\n bdrv_co_preadv(void *bs, int64_t offset, int64_t nbytes, unsigned int flags) \"bs %p offset %\"PRId64\" nbytes %\"PRId64\" flags 0x%x\"\n bdrv_co_pwritev(void *bs, int64_t offset, int64_t nbytes, unsigned int flags) \"bs %p offset %\"PRId64\" nbytes %\"PRId64\" flags 0x%x\"\n bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int count, int flags) \"bs %p offset %\"PRId64\" count %d flags 0x%x\"\n-bdrv_co_do_copy_on_readv(void *bs, int64_t offset, unsigned int bytes, int64_t cluster_offset, unsigned int cluster_bytes) \"bs %p offset %\"PRId64\" bytes %u cluster_offset %\"PRId64\" cluster_bytes %u\"\n+bdrv_co_do_copy_on_readv(void *bs, int64_t offset, int64_t bytes, int64_t cluster_offset, unsigned int cluster_bytes) \"bs %p offset %\"PRId64\" bytes %\"PRId64\" cluster_offset %\"PRId64\" cluster_bytes %u\"\n\n # block/stream.c\n stream_one_iteration(void *s, int64_t offset, uint64_t bytes, int is_allocated) \"s %p offset %\" PRId64 \" bytes %\" PRIu64 \" is_allocated %d\"\n", "prefixes": [ "v4", "03/23" ] }