get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2216580,
    "url": "http://patchwork.ozlabs.org/api/patches/2216580/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260326210532.379027-5-peterx@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": "<20260326210532.379027-5-peterx@redhat.com>",
    "list_archive_url": null,
    "date": "2026-03-26T21:05:25",
    "name": "[RFC,v2,04/11] vmstate: Update max_elems early and check field compressable once",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "9d2e2d8f978c730cd92652a0eed658edc0a02cf0",
    "submitter": {
        "id": 67717,
        "url": "http://patchwork.ozlabs.org/api/people/67717/?format=api",
        "name": "Peter Xu",
        "email": "peterx@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260326210532.379027-5-peterx@redhat.com/mbox/",
    "series": [
        {
            "id": 497651,
            "url": "http://patchwork.ozlabs.org/api/series/497651/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497651",
            "date": "2026-03-26T21:05:22",
            "name": "vmstate: Implement VMS_ARRAY_OF_POINTER_AUTO_ALLOC",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/497651/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2216580/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2216580/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@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=XFci+OH3;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=pjGdl4yf;\n\tdkim-atps=neutral",
            "legolas.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=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhbtl1GSDz1y1j\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 08:06:55 +1100 (AEDT)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w5rtl-00048F-2B; Thu, 26 Mar 2026 17:05:49 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <peterx@redhat.com>) id 1w5rti-00047S-O4\n for qemu-devel@nongnu.org; Thu, 26 Mar 2026 17:05:47 -0400",
            "from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <peterx@redhat.com>) id 1w5rth-00035w-75\n for qemu-devel@nongnu.org; Thu, 26 Mar 2026 17:05:46 -0400",
            "from mail-qk1-f200.google.com (mail-qk1-f200.google.com\n [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-240-wpuKSBOTOGWt_Faie53Rag-1; Thu, 26 Mar 2026 17:05:42 -0400",
            "by mail-qk1-f200.google.com with SMTP id\n af79cd13be357-8cd827a356aso353776785a.3\n for <qemu-devel@nongnu.org>; Thu, 26 Mar 2026 14:05:42 -0700 (PDT)",
            "from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8d00e4fa7d9sm353479785a.32.2026.03.26.14.05.40\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 26 Mar 2026 14:05:40 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1774559144;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=NhAUULl4qMWtcriJZslSelYi7+LKHXIebTcjt2KeKTg=;\n b=XFci+OH38VjnIzycQlYKsNGN89ZHEVLCf570AsevZHR+H43Ql/asJXx4vFSk9ySnEVOXIt\n cjJjUytNSLbSpOBzjQ/3YlPVNNn+JKlUREeh3h6Ih4OPG5p/BFe+8X9pW3fJ5DCTKNIVEb\n ObeUSFwhPafwx8IX4choMJ/E3amb9FI=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1774559142; x=1775163942; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=NhAUULl4qMWtcriJZslSelYi7+LKHXIebTcjt2KeKTg=;\n b=pjGdl4yfSRUU5G6GDqSS++c0vpezSFiyENIBpWV/0UCqEu3+JWw5hauy0jvZ8qwkxj\n olI1L4xgHT2XOGiUFvr5PdsL/hPjV2pawuaL3cSCpy17moXPwMNsJkOiOagA0NOQV0Iq\n yIbdmdfkLJvodwU6uGwGOoWhzpfj7UE/Dsnne+XdxHd1jJM5aDEQb/vycdpTgIAf2CLB\n srO3lktIv53X6wJ/bhoS4c19hYpR2DdXS/yWTaa3+1ogpH/ro5mRvYvIdW95noqT4Nrh\n UJdR8UcXmzOzmatyK4j7PPGzndzU69ri3aHhU/zR9riYwzW8ZRpYf6ixvgH7BnRFw1f7\n dFQA=="
        ],
        "X-MC-Unique": "wpuKSBOTOGWt_Faie53Rag-1",
        "X-Mimecast-MFC-AGG-ID": "wpuKSBOTOGWt_Faie53Rag_1774559142",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774559142; x=1775163942;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=NhAUULl4qMWtcriJZslSelYi7+LKHXIebTcjt2KeKTg=;\n b=O2Se81z2mDYKX4/6BrG030BvVSr0hqAxisWhPSfApLJmhLAml76UFlGTRj2OgHUT1f\n sgjls+dhqocdpVJKMgq73Jd6UzdbfAn1E35H5yNWyPORFZQKN86vNTi4Dx+qqF/7L6Ug\n wdS1bCQGCWJvtsi3vYk30ir+DWPa0Eff6jXzWTbZ2TI6dWsKlT6yqobrfqamSWVlZpT1\n aEYCyLv/yQodghAuYeTg0Zezesvuavj9k1pgB8B16sdFkH1fhgjFXvAq8U4u373r8hEA\n 8JqeT75yf0kFuZn3AIAFp2l8LVeoALiPNtPaMjqXy8v362G2QR1O8hqA4hP3mqSn1xT5\n wSvA==",
        "X-Gm-Message-State": "AOJu0YyR2CDSCQ9AkW5LJnLK/XUojI33Xqv5wknTP85zx31SjXSbg18L\n g5dxhQL7kDGgeZfC+Psi4t4c85vcMGOni6wRhVuuEsqncUMMkxZNUz/eiVtgnXZcBvAG5H0n1M0\n dvbUhieGXh1/cmBftKGgevH6yNQQyZfDY2KU/OXmuIxgaFQiNaxiN36UbeO2VzM/y9taj893dy5\n qZ5vESbCrv4zybrd/h60MLYGgiHccMThEFPvH2YA==",
        "X-Gm-Gg": "ATEYQzygKDLhzRUteUrmyRzh1xldSfZv3QrAP0+RR0H7CKHUokFNy/pKgFb6uPV1lri\n Xnc2/DR3/BLx9JtuEzhyRWgzBaXSPaDzgL9ah806EEMymOUtwKtXqQXIxN8JozwuE4dadkRbiJj\n wFzhQWdvtC13PBnTl5NN9pbEoleLsXUAJxow5l78BnG1byrtATZUhPP4MrF4l3HL0cBt77+fCuD\n N1yWKAlCj3GssbkJiharx1oN/fpMZHRkeJP7mO+1dA+1LSitxQANnU0jg9YcIXeDJ3ayhuNHIlr\n Q0ULMC9WyYEwDrIWGnnxhHlc+aMl2R5aLidRN6PcaYC640+lR8Uu8owYChJNZrKK6e+DkE1pHDi\n 873YJXDaZK7Q=",
        "X-Received": [
            "by 2002:a05:620a:4591:b0:8cf:de7b:42c8 with SMTP id\n af79cd13be357-8d000f1dbabmr1302952485a.24.1774559141748;\n Thu, 26 Mar 2026 14:05:41 -0700 (PDT)",
            "by 2002:a05:620a:4591:b0:8cf:de7b:42c8 with SMTP id\n af79cd13be357-8d000f1dbabmr1302946085a.24.1774559141193;\n Thu, 26 Mar 2026 14:05:41 -0700 (PDT)"
        ],
        "From": "Peter Xu <peterx@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Alexander Mikhalitsyn <alexander@mihalicyn.com>, peterx@redhat.com,\n Fabiano Rosas <farosas@suse.de>, Juraj Marcin <jmarcin@redhat.com>",
        "Subject": "[PATCH RFC v2 04/11] vmstate: Update max_elems early and check field\n compressable once",
        "Date": "Thu, 26 Mar 2026 17:05:25 -0400",
        "Message-ID": "<20260326210532.379027-5-peterx@redhat.com>",
        "X-Mailer": "git-send-email 2.50.1",
        "In-Reply-To": "<20260326210532.379027-1-peterx@redhat.com>",
        "References": "<20260326210532.379027-1-peterx@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com",
        "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, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "qemu development <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>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "QEMU has a trick in vmstate_save_vmsd_v(), where it will try to compress\nmultiple JSON entries into one with a count to avoid duplicated entries.\n\nThat only applies to the cases where vmsd_can_compress() should return\ntrue.  For example, vmsd_desc_field_start() later (who will take the\nupdated max_elems as the last parameter) will ignore the value passed in\nwhen vmsd_can_compress() returns false.\n\nDo that check once at the start of loop, and use it to update max_elems, so\nthat max_elems keeps 1 for uncompressable VMSD fields, which is more\nstraightforward.\n\nThis also paves way to make this counter work for ptr marker VMSD fields\ntoo.\n\nNo functional change intended in this patch alone.\n\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n migration/vmstate.c | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/migration/vmstate.c b/migration/vmstate.c\nindex e29a8c3f49..05badef42f 100644\n--- a/migration/vmstate.c\n+++ b/migration/vmstate.c\n@@ -556,7 +556,8 @@ static bool vmstate_save_vmsd_v(QEMUFile *f, const VMStateDescription *vmsd,\n                 void *curr_elem = first_elem + size * i;\n                 const VMStateField *inner_field;\n                 bool is_null;\n-                int max_elems = n_elems - i;\n+                /* maximum number of elements to compress in the JSON blob */\n+                int max_elems = vmsd_can_compress(field) ? (n_elems - i) : 1;\n \n                 old_offset = qemu_file_transferred(f);\n                 if (field->flags & VMS_ARRAY_OF_POINTER) {\n@@ -587,7 +588,8 @@ static bool vmstate_save_vmsd_v(QEMUFile *f, const VMStateDescription *vmsd,\n                  * vs. nullptr). Search ahead for the next null/non-null element\n                  * and start a new compressed array if found.\n                  */\n-                if (vmdesc && (field->flags & VMS_ARRAY_OF_POINTER) &&\n+                if (vmdesc && max_elems > 1 &&\n+                    (field->flags & VMS_ARRAY_OF_POINTER) &&\n                     is_null != is_prev_null) {\n \n                     is_prev_null = is_null;\n@@ -626,7 +628,7 @@ static bool vmstate_save_vmsd_v(QEMUFile *f, const VMStateDescription *vmsd,\n                 }\n \n                 /* Compressed arrays only care about the first element */\n-                if (vmdesc_loop && vmsd_can_compress(field)) {\n+                if (vmdesc_loop && max_elems > 1) {\n                     vmdesc_loop = NULL;\n                 }\n             }\n",
    "prefixes": [
        "RFC",
        "v2",
        "04/11"
    ]
}