get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2229020,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229020/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260427170520.101242-3-kwolf@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.1/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": ""
    },
    "msgid": "<20260427170520.101242-3-kwolf@redhat.com>",
    "date": "2026-04-27T17:05:18",
    "name": "[2/4] qemu-io: Add 'aio_discard' command",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "7fb3aacce2201c4d65c10547ba7f7a2bd578d643",
    "submitter": {
        "id": 2714,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/2714/?format=api",
        "name": "Kevin Wolf",
        "email": "kwolf@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260427170520.101242-3-kwolf@redhat.com/mbox/",
    "series": [
        {
            "id": 501688,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/501688/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501688",
            "date": "2026-04-27T17:05:16",
            "name": "qcow2: Fix corruption on discard during write with COW",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/501688/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2229020/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2229020/checks/",
    "tags": {},
    "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=A1e6yITK;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.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 4g492B2c9gz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 03:06:10 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHPP8-0007c7-0k; Mon, 27 Apr 2026 13:05:54 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <kwolf@redhat.com>) id 1wHPP5-0007af-H5\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 13:05:51 -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 <kwolf@redhat.com>) id 1wHPP3-0006TS-OR\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 13:05:51 -0400",
            "from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-148-euhHDi6PP8q6vcHVmnplng-1; Mon,\n 27 Apr 2026 13:05:45 -0400",
            "from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 65FF819560B0; Mon, 27 Apr 2026 17:05:44 +0000 (UTC)",
            "from merkur.fritz.box (unknown [10.44.49.22])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 440F71800446; Mon, 27 Apr 2026 17:05:42 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777309549;\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=3kv75jBc4wfec0Dved34GH/yumDj1olUf9AKVp+bi4g=;\n b=A1e6yITKIB/c5C863dyjtv8M+654qKx5T3XXX4z6Uzf6mAMrWg9BBkeKa6QlqWLSSP6ec3\n T3sKCbH4wffxATcewHjsUcWIMlqq556MdDMnBh3A1Kn7jnQ4Ltm/Z/WrN6WTy1pepWrJXU\n JH+y4bB0qFuJfb5ykSngyMm8Fp3hC0U=",
        "X-MC-Unique": "euhHDi6PP8q6vcHVmnplng-1",
        "X-Mimecast-MFC-AGG-ID": "euhHDi6PP8q6vcHVmnplng_1777309544",
        "From": "Kevin Wolf <kwolf@redhat.com>",
        "To": "qemu-block@nongnu.org",
        "Cc": "kwolf@redhat.com, hreitz@redhat.com, den@openvz.org, stefanha@redhat.com,\n qemu-stable@nongnu.org, qemu-devel@nongnu.org",
        "Subject": "[PATCH 2/4] qemu-io: Add 'aio_discard' command",
        "Date": "Mon, 27 Apr 2026 19:05:18 +0200",
        "Message-ID": "<20260427170520.101242-3-kwolf@redhat.com>",
        "In-Reply-To": "<20260427170520.101242-1-kwolf@redhat.com>",
        "References": "<20260427170520.101242-1-kwolf@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.111",
        "Received-SPF": "pass client-ip=170.10.133.124; envelope-from=kwolf@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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_PASS=-0.001,\n SPF_PASS=-0.001 autolearn=unavailable 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": "Testing interactions between multiple requests that include discard\nrequests require that qemu-io can do the discard asynchronously, like it\nalready does for reads and writes. To this effect, add an 'aio_discard'\ncommand.\n\nSigned-off-by: Kevin Wolf <kwolf@redhat.com>\n---\n qemu-io-cmds.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 113 insertions(+)",
    "diff": "diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c\nindex 13e03301624..0f5baa70f94 100644\n--- a/qemu-io-cmds.c\n+++ b/qemu-io-cmds.c\n@@ -2218,6 +2218,118 @@ static int discard_f(BlockBackend *blk, int argc, char **argv)\n     return 0;\n }\n \n+static void aio_discard_help(void)\n+{\n+    printf(\n+\"\\n\"\n+\" asynchronously discards a range of bytes from the given offset\\n\"\n+\"\\n\"\n+\" Example:\\n\"\n+\" 'aio_discard 512 1k' - discards 1 kilobyte from 512 bytes into the file\\n\"\n+\"\\n\"\n+\" Discards a segment of the currently open file.\\n\"\n+\" -C, -- report statistics in a machine parsable format\\n\"\n+\" -q, -- quiet mode, do not show I/O statistics\\n\"\n+\" The discard is performed asynchronously and the aio_flush command must be\\n\"\n+\" used to ensure all outstanding aio requests have been completed.\\n\"\n+\" Note that due to its asynchronous nature, this command will be\\n\"\n+\" considered successful once the request is submitted, independently\\n\"\n+\" of potential I/O errors.\\n\"\n+\"\\n\");\n+}\n+\n+static int aio_discard_f(BlockBackend *blk, int argc, char **argv);\n+\n+static const cmdinfo_t aio_discard_cmd = {\n+    .name       = \"aio_discard\",\n+    .cfunc      = aio_discard_f,\n+    .perm       = BLK_PERM_WRITE,\n+    .argmin     = 2,\n+    .argmax     = -1,\n+    .args       = \"[-Cq] off len\",\n+    .oneline    = \"asynchronously discards a number of bytes\",\n+    .help       = aio_discard_help,\n+};\n+\n+static void aio_discard_done(void *opaque, int ret)\n+{\n+    struct aio_ctx *ctx = opaque;\n+    struct timespec t2;\n+\n+    clock_gettime(CLOCK_MONOTONIC, &t2);\n+\n+    if (ret < 0) {\n+        printf(\"aio_discard failed: %s\\n\", strerror(-ret));\n+        block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct);\n+        goto out;\n+    }\n+\n+    block_acct_done(blk_get_stats(ctx->blk), &ctx->acct);\n+\n+    if (ctx->qflag) {\n+        goto out;\n+    }\n+\n+    /* Finally, report back -- -C gives a parsable format */\n+    t2 = tsub(t2, ctx->t1);\n+    print_report(\"discarded \", &t2, ctx->offset, ctx->qiov.size,\n+                 ctx->qiov.size, 1, ctx->Cflag);\n+out:\n+    g_free(ctx);\n+}\n+\n+static int aio_discard_f(BlockBackend *blk, int argc, char **argv)\n+{\n+    int c, ret;\n+    int64_t count;\n+    struct aio_ctx *ctx = g_new0(struct aio_ctx, 1);\n+\n+    ctx->blk = blk;\n+\n+    while ((c = getopt(argc, argv, \"Cq\")) != -1) {\n+        switch (c) {\n+        case 'C':\n+            ctx->Cflag = true;\n+            break;\n+        case 'q':\n+            ctx->qflag = true;\n+            break;\n+        default:\n+            qemuio_command_usage(&aio_discard_cmd);\n+            return -EINVAL;\n+        }\n+    }\n+\n+    if (optind != argc - 2) {\n+        qemuio_command_usage(&aio_discard_cmd);\n+        return -EINVAL;\n+    }\n+\n+    ctx->offset = cvtnum(argv[optind]);\n+    if (ctx->offset < 0) {\n+        ret = ctx->offset;\n+        print_cvtnum_err(ret, argv[optind]);\n+        g_free(ctx);\n+        return ret;\n+    }\n+    optind++;\n+\n+    count = cvtnum(argv[optind]);\n+    if (count < 0) {\n+        print_cvtnum_err(count, argv[optind]);\n+        g_free(ctx);\n+        return count;\n+    }\n+\n+    clock_gettime(CLOCK_MONOTONIC, &ctx->t1);\n+    ctx->qiov.size = count;\n+    block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size,\n+                     BLOCK_ACCT_UNMAP);\n+    blk_aio_pdiscard(blk, ctx->offset, count, aio_discard_done, ctx);\n+\n+    return 0;\n+}\n+\n static int alloc_f(BlockBackend *blk, int argc, char **argv)\n {\n     BlockDriverState *bs = blk_bs(blk);\n@@ -2800,6 +2912,7 @@ static void __attribute((constructor)) init_qemuio_commands(void)\n     qemuio_add_command(&length_cmd);\n     qemuio_add_command(&info_cmd);\n     qemuio_add_command(&discard_cmd);\n+    qemuio_add_command(&aio_discard_cmd);\n     qemuio_add_command(&alloc_cmd);\n     qemuio_add_command(&map_cmd);\n     qemuio_add_command(&reopen_cmd);\n",
    "prefixes": [
        "2/4"
    ]
}