get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1307003,
    "url": "http://patchwork.ozlabs.org/api/patches/1307003/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/812b66824859bee38019fc4d35bda0985b13789f.1591801197.git.berto@igalia.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": "<812b66824859bee38019fc4d35bda0985b13789f.1591801197.git.berto@igalia.com>",
    "list_archive_url": null,
    "date": "2020-06-10T15:02:53",
    "name": "[v8,15/34] qcow2: Add qcow2_get_subcluster_range_type()",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "e24505b3b952c69342ce6b365995dcc7e8172bac",
    "submitter": {
        "id": 65704,
        "url": "http://patchwork.ozlabs.org/api/people/65704/?format=api",
        "name": "Alberto Garcia",
        "email": "berto@igalia.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/812b66824859bee38019fc4d35bda0985b13789f.1591801197.git.berto@igalia.com/mbox/",
    "series": [
        {
            "id": 182563,
            "url": "http://patchwork.ozlabs.org/api/series/182563/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=182563",
            "date": "2020-06-10T15:02:49",
            "name": "Add subcluster allocation to qcow2",
            "version": 8,
            "mbox": "http://patchwork.ozlabs.org/series/182563/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1307003/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1307003/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 spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=<UNKNOWN>)",
            "ozlabs.org;\n dmarc=none (p=none dis=none) header.from=igalia.com",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=igalia.com header.i=@igalia.com header.a=rsa-sha256\n header.s=20170329 header.b=jL2wnb5M;\n\tdkim-atps=neutral"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49hr0G4Wlkz9sQx\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 11 Jun 2020 01:05:50 +1000 (AEST)",
            "from localhost ([::1]:49162 helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1jj2IW-0002j1-9Q\n\tfor incoming@patchwork.ozlabs.org; Wed, 10 Jun 2020 11:05:48 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10]:35962)\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <berto@igalia.com>)\n id 1jj2Gb-0002J6-Th; Wed, 10 Jun 2020 11:03:49 -0400",
            "from fanzine.igalia.com ([178.60.130.6]:58071)\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <berto@igalia.com>)\n id 1jj2GX-0006vz-C7; Wed, 10 Jun 2020 11:03:49 -0400",
            "from [81.0.38.199] (helo=perseus.local)\n by fanzine.igalia.com with esmtpsa\n (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim)\n id 1jj2GR-0007gv-CG; Wed, 10 Jun 2020 17:03:39 +0200",
            "from berto by perseus.local with local (Exim 4.92)\n (envelope-from <berto@igalia.com>)\n id 1jj2GC-0007N4-3H; Wed, 10 Jun 2020 17:03:24 +0200"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n s=20170329;\n h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From;\n bh=VTJ0AleYo0FtKqUbQGMQJVxhmwOgUpH8CMhdCjrgWgs=;\n b=jL2wnb5Mdn4V8Lplb5aCBWpZiAQgITHO91qcKVX705DrdvSUAhhKspvDEQRmdLblkj06YYO+nfZtGoAcUc3qRfkCPTShzHQV+OM2gtSeSC+YXtZC4rgUnSqpeXpqxXJeoxz5F1VItEgc3rd30kQjTccn57NpYDEW3nX5pYIoRsNTdKmmYmeWQJHht6fgsKNkdhvJKNdqzlOlngW73QjxQf+5+EDepzqkYVTpNsI0szi/in3UtVQxejg+4EnSIECwD9FaMmPX1DmWzEZ9cUt0MkZ8XAe9i+Slf01I4Ag6NDjFCAU5OoaB+dmebBvaksgk+X5Q7z/XwHDM6csjv8woeA==;",
        "From": "Alberto Garcia <berto@igalia.com>",
        "To": "qemu-devel@nongnu.org",
        "Subject": "[PATCH v8 15/34] qcow2: Add qcow2_get_subcluster_range_type()",
        "Date": "Wed, 10 Jun 2020 17:02:53 +0200",
        "Message-Id": "\n <812b66824859bee38019fc4d35bda0985b13789f.1591801197.git.berto@igalia.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<cover.1591801197.git.berto@igalia.com>",
        "References": "<cover.1591801197.git.berto@igalia.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=178.60.130.6; envelope-from=berto@igalia.com;\n helo=fanzine.igalia.com",
        "X-detected-operating-system": "by eggs.gnu.org: First seen = 2020/06/10 11:03:39",
        "X-ACL-Warn": "Detected OS   = Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy]",
        "X-Spam_score_int": "-20",
        "X-Spam_score": "-2.1",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=_AUTOLEARN",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.23",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://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 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "Kevin Wolf <kwolf@redhat.com>,\n Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,\n Alberto Garcia <berto@igalia.com>, qemu-block@nongnu.org,\n Derek Su <dereksu@qnap.com>, Max Reitz <mreitz@redhat.com>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "There are situations in which we want to know how many contiguous\nsubclusters of the same type there are in a given cluster. This can be\ndone by simply iterating over the subclusters and repeatedly calling\nqcow2_get_subcluster_type() for each one of them.\n\nHowever once we determined the type of a subcluster we can check the\nrest efficiently by counting the number of adjacent ones (or zeroes)\nin the bitmap. This is what this function does.\n\nSigned-off-by: Alberto Garcia <berto@igalia.com>\nReviewed-by: Eric Blake <eblake@redhat.com>\n---\n block/qcow2-cluster.c | 51 +++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 51 insertions(+)",
    "diff": "diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c\nindex 8b2fc550b7..32dc6e75e3 100644\n--- a/block/qcow2-cluster.c\n+++ b/block/qcow2-cluster.c\n@@ -375,6 +375,57 @@ fail:\n     return ret;\n }\n \n+/*\n+ * For a given L2 entry, count the number of contiguous subclusters of\n+ * the same type starting from @sc_from. Compressed clusters are\n+ * treated as if they were divided into subclusters of size\n+ * s->subcluster_size.\n+ *\n+ * Return the number of contiguous subclusters and set @type to the\n+ * subcluster type.\n+ *\n+ * If the L2 entry is invalid return -errno and set @type to\n+ * QCOW2_SUBCLUSTER_INVALID.\n+ */\n+G_GNUC_UNUSED\n+static int qcow2_get_subcluster_range_type(BlockDriverState *bs,\n+                                           uint64_t l2_entry,\n+                                           uint64_t l2_bitmap,\n+                                           unsigned sc_from,\n+                                           QCow2SubclusterType *type)\n+{\n+    BDRVQcow2State *s = bs->opaque;\n+    uint32_t val;\n+\n+    *type = qcow2_get_subcluster_type(bs, l2_entry, l2_bitmap, sc_from);\n+\n+    if (*type == QCOW2_SUBCLUSTER_INVALID) {\n+        return -EINVAL;\n+    } else if (!has_subclusters(s) || *type == QCOW2_SUBCLUSTER_COMPRESSED) {\n+        return s->subclusters_per_cluster - sc_from;\n+    }\n+\n+    switch (*type) {\n+    case QCOW2_SUBCLUSTER_NORMAL:\n+        val = l2_bitmap | QCOW_OFLAG_SUB_ALLOC_RANGE(0, sc_from);\n+        return cto32(val) - sc_from;\n+\n+    case QCOW2_SUBCLUSTER_ZERO_PLAIN:\n+    case QCOW2_SUBCLUSTER_ZERO_ALLOC:\n+        val = (l2_bitmap | QCOW_OFLAG_SUB_ZERO_RANGE(0, sc_from)) >> 32;\n+        return cto32(val) - sc_from;\n+\n+    case QCOW2_SUBCLUSTER_UNALLOCATED_PLAIN:\n+    case QCOW2_SUBCLUSTER_UNALLOCATED_ALLOC:\n+        val = ((l2_bitmap >> 32) | l2_bitmap)\n+            & ~QCOW_OFLAG_SUB_ALLOC_RANGE(0, sc_from);\n+        return ctz32(val) - sc_from;\n+\n+    default:\n+        g_assert_not_reached();\n+    }\n+}\n+\n /*\n  * Checks how many clusters in a given L2 slice are contiguous in the image\n  * file. As soon as one of the flags in the bitmask stop_flags changes compared\n",
    "prefixes": [
        "v8",
        "15/34"
    ]
}