get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2196389,
    "url": "http://patchwork.ozlabs.org/api/patches/2196389/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260213171622.55629-2-zhangckid@gmail.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": "<20260213171622.55629-2-zhangckid@gmail.com>",
    "list_archive_url": null,
    "date": "2026-02-13T17:16:20",
    "name": "[V4,2/4] iothread: introduce iothread_ref/unref to track attached devices",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "40ae6e05453c61fe00172e21208bfc415f842f39",
    "submitter": {
        "id": 72278,
        "url": "http://patchwork.ozlabs.org/api/people/72278/?format=api",
        "name": "Zhang Chen",
        "email": "zhangckid@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260213171622.55629-2-zhangckid@gmail.com/mbox/",
    "series": [
        {
            "id": 492123,
            "url": "http://patchwork.ozlabs.org/api/series/492123/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=492123",
            "date": "2026-02-13T17:16:20",
            "name": "[V4,1/4] qapi/misc: Fix missed query-iothreads items",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/492123/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2196389/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2196389/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 (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=SPEpB4GJ;\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 4fCJl60vcGz1xvQ\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 14 Feb 2026 04:17:36 +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 1vqwmh-0007b9-Rj; Fri, 13 Feb 2026 12:16:51 -0500",
            "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 <zhangckid@gmail.com>)\n id 1vqwmg-0007aP-TZ\n for qemu-devel@nongnu.org; Fri, 13 Feb 2026 12:16:50 -0500",
            "from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <zhangckid@gmail.com>)\n id 1vqwmf-0006xF-B5\n for qemu-devel@nongnu.org; Fri, 13 Feb 2026 12:16:50 -0500",
            "by mail-pg1-x52a.google.com with SMTP id\n 41be03b00d2f7-c6e2355739dso422378a12.2\n for <qemu-devel@nongnu.org>; Fri, 13 Feb 2026 09:16:48 -0800 (PST)",
            "from localhost.localdomain ([104.168.88.121])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2ab29998c45sm87095575ad.88.2026.02.13.09.16.42\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Fri, 13 Feb 2026 09:16:46 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20230601; t=1771003007; x=1771607807; 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=sZmqtt/8+oeOxNbDkz0krc0Bz9lQjPbmA6qcD9QBIYk=;\n b=SPEpB4GJk+7YKZWuJf88REqdGtqbht2xjads1RSbCNLM/xl/xYBdHYAeL2ZypCR+0f\n OnRvKpej6ot0ZFiNdjLHlOmxIiB3hln32DwRPUvSQ8Yb+Y2lGyF0c/VuWVUvg8v99mih\n RSdKPKPbDjfXDCylvoBKh4Cvko4KCXr+K0SU2nYsEEfXeqLq2vzkkedqSGLHuz/LhyVh\n //O8rKtGaHmxA67kFMyUQVQUo+B41yrUfpgKAN37+DGRHs6GpQ5KmGABCYSWpOEhSvFV\n N93MeJBRwJbkq50R3DnSulvbEoSmCXtaRW1rTj4DXwP05Be7jP5muZ+mWBj45QFVEPqT\n 1hPA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1771003007; x=1771607807;\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=sZmqtt/8+oeOxNbDkz0krc0Bz9lQjPbmA6qcD9QBIYk=;\n b=OkvvDxjunyYqfXF7YHA2SMgwZiXUswkpoTTtzsxcuZEUy0jiph9s3fG5mX7QPn677i\n ugt5yBDA7oAAQF44wko1ghM4P/U2+o/kDUYlu40itKrgCkjsdo/VEudEdyNXqaBEah9R\n rHyi50zMf5Yb7wnab5E7YWa+d3jifyt/McxMbHgzr82qxUSUsesKmVA2t3ZgpcSgVb3H\n Tftzbf7kHc4eMN+che9xCY4fvMTC1y2So8+oMNN4xqvWG/XbjPQCnct+z5BybU5AxnSd\n KJmbfHJl6VY5iCXf/6Pvds9AXMRD0hU2npsmdAO+HRiiXIChyOQajXIiWRe4++8nwQj1\n 43yw==",
        "X-Gm-Message-State": "AOJu0Yz1+BgPEJDMmptVZ1kf5vj91ZGaQHlh5uB78JZ74Ej78giXqRmU\n gFpOofPRmXihPZUzudkf6O9RFKcds674MqL2GKFIPfMrTH9AdF/Ec4GTIHyrPld4",
        "X-Gm-Gg": "AZuq6aKBc8sqpkpQGJLvg2LMkqY2bfQ2XB/xxosWFvQi6BuK0PrLXtOI7UpNVUG03Bh\n yLbwBY+1oOeDp+0bJPhWz9w+9/mnbPSC2h+QT70tNMZtpBY/h5hgSCP3w1afwCdDYMxf8bOOgri\n 1QoQquntkp50j7RFF2t2i0VxjjDHU/+r5/SwLJUtNJ1M+TxdPxli1wXLk3e7hebB9XalZ2lqTEE\n F9m1lgG3SjQUACH4XcDSVAkXQYscH2BEx113YXMkCwaiajlsQSEV7RnYlyJHlZ8rOv8HwASD9q4\n MxxYjUwvjV0e7VzPMCRP6XOYIoD0bIbCqcoT8AmwKrWzhjmlIled6VeSn/dq/tw6p/scXkZbeWl\n nH3JC7ynXXwmR64HKA/RVrPIEz93hmVtmQe758WhPTHUGo5L68EN0Afiq5bhL2ObhaZVY9FxDIS\n tXfjl1+vx/zsWwCe8rPJ0sAwOmlFElkGjJiPw=",
        "X-Received": "by 2002:a17:902:da89:b0:2aa:d316:f30e with SMTP id\n d9443c01a7336-2ab50586bf7mr25872835ad.28.1771003007296;\n Fri, 13 Feb 2026 09:16:47 -0800 (PST)",
        "From": "Zhang Chen <zhangckid@gmail.com>",
        "To": "qemu-devel <qemu-devel@nongnu.org>,\n \"Dr . David Alan Gilbert\" <dave@treblig.org>,\n Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>,\n \"Michael S . Tsirkin\" <mst@redhat.com>,\n Stefan Hajnoczi <stefanha@redhat.com>",
        "Cc": "Zhang Chen <zhangckid@gmail.com>",
        "Subject": "[PATCH V4 2/4] iothread: introduce iothread_ref/unref to track\n attached devices",
        "Date": "Sat, 14 Feb 2026 01:16:20 +0800",
        "Message-ID": "<20260213171622.55629-2-zhangckid@gmail.com>",
        "X-Mailer": "git-send-email 2.49.0",
        "In-Reply-To": "<20260213171622.55629-1-zhangckid@gmail.com>",
        "References": "<20260213171622.55629-1-zhangckid@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2607:f8b0:4864:20::52a;\n envelope-from=zhangckid@gmail.com; helo=mail-pg1-x52a.google.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, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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": "Currently, IOThreads do not maintain a record of which devices are\nassociated with them. This makes it difficult to monitor the\nworkload distribution of IOThreads, especially in complex\nhotplug scenarios involving multiple virtio-blk or virtio-scsi devices.\n\nThis patch introduces a reference counting and tracking mechanism\nwithin the IOThread object:\n\n- iothread_ref(): Increments the attachment counter and prepends the\n  device's QOM path to a list. Note: The IOThread takes ownership of\n  the passed 'holder' string.\n- iothread_unref(): Searches for the device path using a custom\n  string comparison (g_strcmp0), decrements the counter, and\n  releases the associated memory upon a successful match.\n- attached_cnt: Tracks the number of active device attachments.\n- attached_dev: A GList storing the QOM paths of attached devices\n  for runtime introspection.\n\nThis infrastructure allows management tools and QMP commands to\nquery the attachment status of IOThreads.\n\nSigned-off-by: Zhang Chen <zhangckid@gmail.com>\n---\n include/system/iothread.h |  4 ++++\n iothread.c                | 35 +++++++++++++++++++++++++++++++++++\n 2 files changed, 39 insertions(+)",
    "diff": "diff --git a/include/system/iothread.h b/include/system/iothread.h\nindex e26d13c6c7..4a2ffdb9bd 100644\n--- a/include/system/iothread.h\n+++ b/include/system/iothread.h\n@@ -33,6 +33,8 @@ struct IOThread {\n     bool stopping;              /* has iothread_stop() been called? */\n     bool running;               /* should iothread_run() continue? */\n     int thread_id;\n+    int attached_cnt;\n+    GList *attached_dev;\n \n     /* AioContext poll parameters */\n     int64_t poll_max_ns;\n@@ -48,6 +50,8 @@ char *iothread_get_id(IOThread *iothread);\n IOThread *iothread_by_id(const char *id);\n AioContext *iothread_get_aio_context(IOThread *iothread);\n GMainContext *iothread_get_g_main_context(IOThread *iothread);\n+void iothread_ref(IOThread *iothread, const char* holder);\n+void iothread_unref(IOThread *iothread, const char* holder);\n \n /*\n  * Helpers used to allocate iothreads for internal use.  These\ndiff --git a/iothread.c b/iothread.c\nindex caf68e0764..b869637497 100644\n--- a/iothread.c\n+++ b/iothread.c\n@@ -36,6 +36,41 @@\n #define IOTHREAD_POLL_MAX_NS_DEFAULT 0ULL\n #endif\n \n+/*\n+ * Increment iothread's reference count,\n+ * and add holder device path to the list.\n+ */\n+void iothread_ref(IOThread *iothread, const char *holder)\n+{\n+    iothread->attached_cnt++;\n+    iothread->attached_dev = g_list_prepend(iothread->attached_dev,\n+                                           (gpointer)holder);\n+}\n+\n+/*\n+ * Decrement iothread's reference count,\n+ * and delete holder device path from the list.\n+ */\n+void iothread_unref(IOThread *iothread, const char *holder)\n+{\n+    if (iothread->attached_cnt > 0) {\n+        GList *link = g_list_find_custom(iothread->attached_dev,\n+                                         holder, (GCompareFunc)g_strcmp0);\n+\n+        if (link) {\n+            g_free(link->data);\n+            iothread->attached_dev = g_list_delete_link(iothread->attached_dev,\n+                                                        link);\n+            iothread->attached_cnt--;\n+        } else {\n+            error_report(\"iohtread_unref can't find device. attached_dev=%s\",\n+                        holder);\n+        }\n+    } else {\n+        error_report(\"iohtread_unref counter error. attached_dev=%s\", holder);\n+    }\n+}\n+\n static void *iothread_run(void *opaque)\n {\n     IOThread *iothread = opaque;\n",
    "prefixes": [
        "V4",
        "2/4"
    ]
}