get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1307018,
    "url": "http://patchwork.ozlabs.org/api/patches/1307018/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/80fc75dd6dd7dba6d52ca7a0b57949ce5cabf943.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": "<80fc75dd6dd7dba6d52ca7a0b57949ce5cabf943.1591801197.git.berto@igalia.com>",
    "list_archive_url": null,
    "date": "2020-06-10T15:03:07",
    "name": "[v8,29/34] qcow2: Add subcluster support to qcow2_measure()",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "b8a6474c322b09b15ad505bda9d9bf3200d09fd6",
    "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/80fc75dd6dd7dba6d52ca7a0b57949ce5cabf943.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/1307018/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1307018/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=iqsFaXeI;\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 49hrDr0tK2z9sQx\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 11 Jun 2020 01:16:44 +1000 (AEST)",
            "from localhost ([::1]:57960 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 1jj2T3-0002a4-Q8\n\tfor incoming@patchwork.ozlabs.org; Wed, 10 Jun 2020 11:16:41 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10]:36162)\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 1jj2Gy-0002mB-Rq; Wed, 10 Jun 2020 11:04:12 -0400",
            "from fanzine.igalia.com ([178.60.130.6]:58253)\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 1jj2Gs-0006wf-OT; Wed, 10 Jun 2020 11:04:12 -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-0007hG-SJ; Wed, 10 Jun 2020 17:03:40 +0200",
            "from berto by perseus.local with local (Exim 4.92)\n (envelope-from <berto@igalia.com>)\n id 1jj2GC-0007Nl-HZ; 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=jiMv9S+Pgj4nbYi0/zDdysZBoTSQanZXM6tOp5flWJA=;\n b=iqsFaXeIV39lg3qH+p4JMDNKazZJh0LJwAfzFWaMYQclW13ccfMOFbT9bkI8yI98pSr/KbBvuNXOvOTSKWXNYVEdJmbo25pK8PiwwzHSINKWJSsjbKhe5gJ5OT0ZuUNd/6ORvbb+uzxewrhd6QmpwLmG2/LXBc0+M3Ydz1g9yWQj+RT3rhmnZ421UKZHVSvqwmHQALPjGj1Y8pmoop2b8x+GbTRHeWEgmwQ58IiwtXQei9Mct9DWg7HJ26U2on/YfvPv6Gp3160xXbl69fr6gudlRq6LWWPQSwx/fuZ5LSKAtG90c0Nwu9LTPfmxmxiS5u+AzRTLwc6QzPNKg2JEOQ==;",
        "From": "Alberto Garcia <berto@igalia.com>",
        "To": "qemu-devel@nongnu.org",
        "Subject": "[PATCH v8 29/34] qcow2: Add subcluster support to qcow2_measure()",
        "Date": "Wed, 10 Jun 2020 17:03:07 +0200",
        "Message-Id": "\n <80fc75dd6dd7dba6d52ca7a0b57949ce5cabf943.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": "Extended L2 entries are bigger than normal L2 entries so this has an\nimpact on the amount of metadata needed for a qcow2 file.\n\nSigned-off-by: Alberto Garcia <berto@igalia.com>\nReviewed-by: Max Reitz <mreitz@redhat.com>\n---\n block/qcow2.c | 20 +++++++++++++-------\n 1 file changed, 13 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/block/qcow2.c b/block/qcow2.c\nindex 4edc3c72b9..72bd25e774 100644\n--- a/block/qcow2.c\n+++ b/block/qcow2.c\n@@ -3233,28 +3233,31 @@ int64_t qcow2_refcount_metadata_size(int64_t clusters, size_t cluster_size,\n  * @total_size: virtual disk size in bytes\n  * @cluster_size: cluster size in bytes\n  * @refcount_order: refcount bits power-of-2 exponent\n+ * @extended_l2: true if the image has extended L2 entries\n  *\n  * Returns: Total number of bytes required for the fully allocated image\n  * (including metadata).\n  */\n static int64_t qcow2_calc_prealloc_size(int64_t total_size,\n                                         size_t cluster_size,\n-                                        int refcount_order)\n+                                        int refcount_order,\n+                                        bool extended_l2)\n {\n     int64_t meta_size = 0;\n     uint64_t nl1e, nl2e;\n     int64_t aligned_total_size = ROUND_UP(total_size, cluster_size);\n+    size_t l2e_size = extended_l2 ? L2E_SIZE_EXTENDED : L2E_SIZE_NORMAL;\n \n     /* header: 1 cluster */\n     meta_size += cluster_size;\n \n     /* total size of L2 tables */\n     nl2e = aligned_total_size / cluster_size;\n-    nl2e = ROUND_UP(nl2e, cluster_size / sizeof(uint64_t));\n-    meta_size += nl2e * sizeof(uint64_t);\n+    nl2e = ROUND_UP(nl2e, cluster_size / l2e_size);\n+    meta_size += nl2e * l2e_size;\n \n     /* total size of L1 tables */\n-    nl1e = nl2e * sizeof(uint64_t) / cluster_size;\n+    nl1e = nl2e * l2e_size / cluster_size;\n     nl1e = ROUND_UP(nl1e, cluster_size / sizeof(uint64_t));\n     meta_size += nl1e * sizeof(uint64_t);\n \n@@ -4845,6 +4848,8 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,\n     PreallocMode prealloc;\n     bool has_backing_file;\n     bool has_luks;\n+    bool extended_l2 = false; /* Set to false until the option is added */\n+    size_t l2e_size;\n \n     /* Parse image creation options */\n     cluster_size = qcow2_opt_get_cluster_size_del(opts, &local_err);\n@@ -4910,8 +4915,9 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,\n     virtual_size = ROUND_UP(virtual_size, cluster_size);\n \n     /* Check that virtual disk size is valid */\n+    l2e_size = extended_l2 ? L2E_SIZE_EXTENDED : L2E_SIZE_NORMAL;\n     l2_tables = DIV_ROUND_UP(virtual_size / cluster_size,\n-                             cluster_size / sizeof(uint64_t));\n+                             cluster_size / l2e_size);\n     if (l2_tables * sizeof(uint64_t) > QCOW_MAX_L1_SIZE) {\n         error_setg(&local_err, \"The image size is too large \"\n                                \"(try using a larger cluster size)\");\n@@ -4974,9 +4980,9 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,\n     }\n \n     info = g_new0(BlockMeasureInfo, 1);\n-    info->fully_allocated =\n+    info->fully_allocated = luks_payload_size +\n         qcow2_calc_prealloc_size(virtual_size, cluster_size,\n-                                 ctz32(refcount_bits)) + luks_payload_size;\n+                                 ctz32(refcount_bits), extended_l2);\n \n     /*\n      * Remove data clusters that are not required.  This overestimates the\n",
    "prefixes": [
        "v8",
        "29/34"
    ]
}