get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/815829/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 815829,
    "url": "http://patchwork.ozlabs.org/api/patches/815829/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170919201910.25656-12-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": "<20170919201910.25656-12-eblake@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-19T20:19:01",
    "name": "[v9,11/20] dirty-bitmap: Change bdrv_dirty_iter_next() to report byte offset",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a4b0bb84fc632500050f315b65bb097c6d84cda3",
    "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/20170919201910.25656-12-eblake@redhat.com/mbox/",
    "series": [
        {
            "id": 3964,
            "url": "http://patchwork.ozlabs.org/api/series/3964/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3964",
            "date": "2017-09-19T20:18:54",
            "name": "make dirty-bitmap byte-based",
            "version": 9,
            "mbox": "http://patchwork.ozlabs.org/series/3964/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/815829/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/815829/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=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-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx06.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 3xxZGW4ldyz9sBW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 06:29:07 +1000 (AEST)",
            "from localhost ([::1]:45250 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 1duP8j-0004ui-NH\n\tfor incoming@patchwork.ozlabs.org; Tue, 19 Sep 2017 16:29:05 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:43665)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1duP0v-0006Za-M0\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 16:21:02 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1duP0u-0005hZ-FV\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 16:21:01 -0400",
            "from mx1.redhat.com ([209.132.183.28]:5198)\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 1duP0r-0005et-NW; Tue, 19 Sep 2017 16:20:58 -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 CA00012B3D;\n\tTue, 19 Sep 2017 20:20:56 +0000 (UTC)",
            "from red.redhat.com (ovpn-124-97.rdu2.redhat.com [10.10.124.97])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id AE5E95C891;\n\tTue, 19 Sep 2017 20:20:54 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com CA00012B3D",
        "From": "Eric Blake <eblake@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Tue, 19 Sep 2017 15:19:01 -0500",
        "Message-Id": "<20170919201910.25656-12-eblake@redhat.com>",
        "In-Reply-To": "<20170919201910.25656-1-eblake@redhat.com>",
        "References": "<20170919201910.25656-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.30]);\n\tTue, 19 Sep 2017 20:20:56 +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 v9 11/20] dirty-bitmap: Change\n\tbdrv_dirty_iter_next() to report byte offset",
        "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, famz@redhat.com,\n\tqemu-block@nongnu.org, Jeff Cody <jcody@redhat.com>,\n\tMax 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": "Thanks to recent cleanups, most callers were scaling a return value\nof sectors into bytes (the exception, in qcow2-bitmap, will be\nconverted to byte-based iteration later).  Update the interface to\ndo the scaling internally instead.\n\nIn qcow2-bitmap, the code was specifically checking for an error\nreturn of -1.  To avoid a regression, we either have to make sure\nwe continue to return -1 (rather than a scaled -512) on error, or\nwe have to fix the caller to treat all negative values as error\nrather than just one magic value.  It's easy enough to make both\nchanges at the same time, even though either one in isolation\nwould work.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\nReviewed-by: John Snow <jsnow@redhat.com>\nReviewed-by: Kevin Wolf <kwolf@redhat.com>\nReviewed-by: Fam Zheng <famz@redhat.com>\n\n---\nv8: tweak commit message, add R-b\nv7: return -1, not -512; and fix qcow2-bitmap to check all negatives [Kevin]\nv5-v6: no change\nv4: rebase to persistent bitmap\nv3: no change\nv2: no change\n---\n block/backup.c       | 2 +-\n block/dirty-bitmap.c | 3 ++-\n block/mirror.c       | 8 ++++----\n block/qcow2-bitmap.c | 2 +-\n 4 files changed, 8 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/block/backup.c b/block/backup.c\nindex ac9c018717..06ddbfd03d 100644\n--- a/block/backup.c\n+++ b/block/backup.c\n@@ -375,7 +375,7 @@ static int coroutine_fn backup_run_incremental(BackupBlockJob *job)\n     dbi = bdrv_dirty_iter_new(job->sync_bitmap);\n\n     /* Find the next dirty sector(s) */\n-    while ((offset = bdrv_dirty_iter_next(dbi) * BDRV_SECTOR_SIZE) >= 0) {\n+    while ((offset = bdrv_dirty_iter_next(dbi)) >= 0) {\n         cluster = offset / job->cluster_size;\n\n         /* Fake progress updates for any clusters we skipped */\ndiff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c\nindex 84509476ba..e451916187 100644\n--- a/block/dirty-bitmap.c\n+++ b/block/dirty-bitmap.c\n@@ -503,7 +503,8 @@ void bdrv_dirty_iter_free(BdrvDirtyBitmapIter *iter)\n\n int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter *iter)\n {\n-    return hbitmap_iter_next(&iter->hbi);\n+    int64_t ret = hbitmap_iter_next(&iter->hbi);\n+    return ret < 0 ? -1 : ret * BDRV_SECTOR_SIZE;\n }\n\n /* Called within bdrv_dirty_bitmap_lock..unlock */\ndiff --git a/block/mirror.c b/block/mirror.c\nindex 0b063b3c20..77bf5aa3a4 100644\n--- a/block/mirror.c\n+++ b/block/mirror.c\n@@ -336,10 +336,10 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)\n     int max_io_bytes = MAX(s->buf_size / MAX_IN_FLIGHT, MAX_IO_BYTES);\n\n     bdrv_dirty_bitmap_lock(s->dirty_bitmap);\n-    offset = bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE;\n+    offset = bdrv_dirty_iter_next(s->dbi);\n     if (offset < 0) {\n         bdrv_set_dirty_iter(s->dbi, 0);\n-        offset = bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE;\n+        offset = bdrv_dirty_iter_next(s->dbi);\n         trace_mirror_restart_iter(s, bdrv_get_dirty_count(s->dirty_bitmap) *\n                                   BDRV_SECTOR_SIZE);\n         assert(offset >= 0);\n@@ -370,11 +370,11 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)\n             break;\n         }\n\n-        next_dirty = bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE;\n+        next_dirty = bdrv_dirty_iter_next(s->dbi);\n         if (next_dirty > next_offset || next_dirty < 0) {\n             /* The bitmap iterator's cache is stale, refresh it */\n             bdrv_set_dirty_iter(s->dbi, next_offset);\n-            next_dirty = bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE;\n+            next_dirty = bdrv_dirty_iter_next(s->dbi);\n         }\n         assert(next_dirty == next_offset);\n         nb_chunks++;\ndiff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c\nindex 44329fc74f..b09010b1d3 100644\n--- a/block/qcow2-bitmap.c\n+++ b/block/qcow2-bitmap.c\n@@ -1109,7 +1109,7 @@ static uint64_t *store_bitmap_data(BlockDriverState *bs,\n     sbc = limit >> BDRV_SECTOR_BITS;\n     assert(DIV_ROUND_UP(bm_size, limit) == tb_size);\n\n-    while ((sector = bdrv_dirty_iter_next(dbi)) != -1) {\n+    while ((sector = bdrv_dirty_iter_next(dbi) >> BDRV_SECTOR_BITS) >= 0) {\n         uint64_t cluster = sector / sbc;\n         uint64_t end, write_size;\n         int64_t off;\n",
    "prefixes": [
        "v9",
        "11/20"
    ]
}