get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2218394,
    "url": "http://patchwork.ozlabs.org/api/patches/2218394/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260401072912.355072-11-huiwen.he@linux.dev/",
    "project": {
        "id": 12,
        "url": "http://patchwork.ozlabs.org/api/projects/12/?format=api",
        "name": "Linux CIFS Client",
        "link_name": "linux-cifs-client",
        "list_id": "linux-cifs.vger.kernel.org",
        "list_email": "linux-cifs@vger.kernel.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260401072912.355072-11-huiwen.he@linux.dev>",
    "list_archive_url": null,
    "date": "2026-04-01T07:29:10",
    "name": "[v2,10/12] smb/client: use binary search for SMB1 DOS/SRV error mapping",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a23ef20e40f0b99e6dadabfaaa60a2bd8f038353",
    "submitter": {
        "id": 93029,
        "url": "http://patchwork.ozlabs.org/api/people/93029/?format=api",
        "name": null,
        "email": "huiwen.he@linux.dev"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260401072912.355072-11-huiwen.he@linux.dev/mbox/",
    "series": [
        {
            "id": 498285,
            "url": "http://patchwork.ozlabs.org/api/series/498285/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=498285",
            "date": "2026-04-01T07:29:08",
            "name": "smb: improve search speed of SMB1 maperror",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/498285/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218394/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218394/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-cifs+bounces-10615-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-cifs@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256\n header.s=key1 header.b=UwypDknB;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10615-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev\n header.b=\"UwypDknB\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=91.218.175.180",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.dev",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.dev"
        ],
        "Received": [
            "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4flxXr3ctJz1yGw\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 18:33:00 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 033FF303FDAB\n\tfor <incoming@patchwork.ozlabs.org>; Wed,  1 Apr 2026 07:32:55 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D789D39A05C;\n\tWed,  1 Apr 2026 07:30:54 +0000 (UTC)",
            "from out-180.mta0.migadu.com (out-180.mta0.migadu.com\n [91.218.175.180])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 33F3B3988FA\n\tfor <linux-cifs@vger.kernel.org>; Wed,  1 Apr 2026 07:30:52 +0000 (UTC)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775028654; cv=none;\n b=M5bVZZ92dG8itAaZhV46wKjqwik3BKx3vKCbIp1Jw7ileLzXk23kDnPzuP/XwCVv7nuiu1cH2Tl6DB5c3SVpb3qlpE2/U9sfYx0oGe+AUnDOHaQ40eTaC/pQQQIEtZo59TGcdRF/PUNI5jtVIHtD/u/f5/y7svGrc1m3Xd9CPoQ=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775028654; c=relaxed/simple;\n\tbh=bLYgPgxoM0Ku9melY2KY4DmV+z+6iNRmEmTzqNNlQjM=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=TJDGXOWJKALJlIhyrE5oDy7NLph7hpBlv+KLjIGX4rgJf0kexlkR3J1vfrxOUNMkmJavRy6KNvUlq5R32sgLHUlSfvF+XGlOH/p4hky+YTAv4QwtrdVu2jH6WzOMtENNoTeHVNhZuBAb9O8wC4KdwsLnzSAe7FUbVhwz+arWFgE=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.dev;\n spf=pass smtp.mailfrom=linux.dev;\n dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev\n header.b=UwypDknB; arc=none smtp.client-ip=91.218.175.180",
        "X-Report-Abuse": "Please report any abuse attempt to abuse@migadu.com and\n include these headers.",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1;\n\tt=1775028650;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\t to:to:cc:cc:mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=AQd6gyemc8+zFy61sB3sFsbLgE3vIuKauaKBXjpp6sI=;\n\tb=UwypDknBAChSpqfxM1a15rTztTmgVvQ3yzo9UahMwn6U8pq8wRveFEXjLGSFesbKuOlD+L\n\tQyAQzrjGzASRkFlsThUfGz0RK2SBrXtYHFUZE63CSs6/LmjcRGQRZsB/mhvW57vpDitVrb\n\tg9ArvFL8o3NEpLI0eEE2WmKQhv15AoQ=",
        "From": "huiwen.he@linux.dev",
        "To": "smfrench@gmail.com,\n\tlinkinjeon@kernel.org,\n\tpc@manguebit.org,\n\tronniesahlberg@gmail.com,\n\tsprasad@microsoft.com,\n\ttom@talpey.com,\n\tbharathsm@microsoft.com,\n\tsenozhatsky@chromium.org,\n\tdhowells@redhat.com,\n\tchenxiaosong@kylinos.cn,\n\tchenxiaosong@chenxiaosong.com,\n\ttangyouling@kylinos.cn",
        "Cc": "linux-cifs@vger.kernel.org,\n\tHuiwen He <hehuiwen@kylinos.cn>",
        "Subject": "[PATCH v2 10/12] smb/client: use binary search for SMB1 DOS/SRV error\n mapping",
        "Date": "Wed,  1 Apr 2026 07:29:10 +0000",
        "Message-ID": "<20260401072912.355072-11-huiwen.he@linux.dev>",
        "In-Reply-To": "<20260401072912.355072-1-huiwen.he@linux.dev>",
        "References": "<20260401072912.355072-1-huiwen.he@linux.dev>",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-cifs@vger.kernel.org",
        "List-Id": "<linux-cifs.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-cifs+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-cifs+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Migadu-Flow": "FLOW_OUT"
    },
    "content": "From: Huiwen He <hehuiwen@kylinos.cn>\n\nCurrently, map_smb_to_linux_error() uses linear searches for both\nmapping_table_ERRDOS[] and mapping_table_ERRSRV[].\n\nRefactor this by introducing a helper function smb1_map_to_posix() that\nimplements binary search(as the tables are sorted). This improves lookup\nperformance and reduces code duplication.\n\nAlso remove the sentinel entries from the mapping tables as they are no\nlonger needed with ARRAY_SIZE().\n\nSigned-off-by: Huiwen He <hehuiwen@kylinos.cn>\nReviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>\n---\n fs/smb/client/smb1maperror.c | 67 ++++++++++++++++++++----------------\n 1 file changed, 37 insertions(+), 30 deletions(-)",
    "diff": "diff --git a/fs/smb/client/smb1maperror.c b/fs/smb/client/smb1maperror.c\nindex bed579afc37b..3074c60301ad 100644\n--- a/fs/smb/client/smb1maperror.c\n+++ b/fs/smb/client/smb1maperror.c\n@@ -9,6 +9,7 @@\n  *   Copyright (C) Luke Kenneth Casson Leighton 1997-2001.\n  */\n \n+#include <linux/bsearch.h>\n #include \"cifsproto.h\"\n #include \"smb1proto.h\"\n #include \"smberr.h\"\n@@ -20,13 +21,24 @@ struct smb_to_posix_error {\n \tint posix_code;\n };\n \n+static __always_inline int smb1_posix_error_cmp(const void *_key, const void *_pivot)\n+{\n+\t__u16 key = *(__u16 *)_key;\n+\tconst struct smb_to_posix_error *pivot = _pivot;\n+\n+\tif (key < pivot->smb_err)\n+\t\treturn -1;\n+\tif (key > pivot->smb_err)\n+\t\treturn 1;\n+\treturn 0;\n+}\n+\n static const struct smb_to_posix_error mapping_table_ERRDOS[] = {\n /*\n  * Automatically generated by the `gen_smb1_mapping` script,\n  * sorted by DOS error code (ascending).\n  */\n #include \"smb1_err_dos_map.c\"\n-\t{0, 0}\n };\n \n static const struct smb_to_posix_error mapping_table_ERRSRV[] = {\n@@ -35,7 +47,6 @@ static const struct smb_to_posix_error mapping_table_ERRSRV[] = {\n  * sorted by SRV error code (ascending).\n  */\n #include \"smb1_err_srv_map.c\"\n-\t{0, 0}\n };\n \n /*****************************************************************************\n@@ -72,14 +83,32 @@ search_ntstatus_to_dos_map(__u32 ntstatus)\n \t\t\t\tntstatus_to_dos_cmp);\n }\n \n+static const struct smb_to_posix_error *\n+search_mapping_table_ERRDOS(__u16 smb_err)\n+{\n+\treturn __inline_bsearch(&smb_err, mapping_table_ERRDOS,\n+\t\t\t\tARRAY_SIZE(mapping_table_ERRDOS),\n+\t\t\t\tsizeof(struct smb_to_posix_error),\n+\t\t\t\tsmb1_posix_error_cmp);\n+}\n+\n+static const struct smb_to_posix_error *\n+search_mapping_table_ERRSRV(__u16 smb_err)\n+{\n+\treturn __inline_bsearch(&smb_err, mapping_table_ERRSRV,\n+\t\t\t\tARRAY_SIZE(mapping_table_ERRSRV),\n+\t\t\t\tsizeof(struct smb_to_posix_error),\n+\t\t\t\tsmb1_posix_error_cmp);\n+}\n+\n int\n map_smb_to_linux_error(char *buf, bool logErr)\n {\n \tstruct smb_hdr *smb = (struct smb_hdr *)buf;\n-\tunsigned int i;\n \tint rc = -EIO;\t/* if transport error smb error may not be set */\n \t__u8 smberrclass;\n \t__u16 smberrcode;\n+\tconst struct smb_to_posix_error *err_map = NULL;\n \n \t/* BB if NT Status codes - map NT BB */\n \n@@ -112,38 +141,16 @@ map_smb_to_linux_error(char *buf, bool logErr)\n \n \t/* old style errors */\n \n-\t/* DOS class smb error codes - map DOS */\n \tif (smberrclass == ERRDOS) {\n+\t\t/* DOS class smb error codes - map DOS */\n \t\t/* 1 byte field no need to byte reverse */\n-\t\tfor (i = 0;\n-\t\t     i <\n-\t\t     sizeof(mapping_table_ERRDOS) /\n-\t\t     sizeof(struct smb_to_posix_error); i++) {\n-\t\t\tif (mapping_table_ERRDOS[i].smb_err == 0)\n-\t\t\t\tbreak;\n-\t\t\telse if (mapping_table_ERRDOS[i].smb_err ==\n-\t\t\t\t\t\t\t\tsmberrcode) {\n-\t\t\t\trc = mapping_table_ERRDOS[i].posix_code;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\t/* else try next error mapping one to see if match */\n-\t\t}\n+\t\terr_map = search_mapping_table_ERRDOS(smberrcode);\n \t} else if (smberrclass == ERRSRV) {\n \t\t/* server class of error codes */\n-\t\tfor (i = 0;\n-\t\t     i <\n-\t\t     sizeof(mapping_table_ERRSRV) /\n-\t\t     sizeof(struct smb_to_posix_error); i++) {\n-\t\t\tif (mapping_table_ERRSRV[i].smb_err == 0)\n-\t\t\t\tbreak;\n-\t\t\telse if (mapping_table_ERRSRV[i].smb_err ==\n-\t\t\t\t\t\t\t\tsmberrcode) {\n-\t\t\t\trc = mapping_table_ERRSRV[i].posix_code;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\t/* else try next error mapping to see if match */\n-\t\t}\n+\t\terr_map = search_mapping_table_ERRSRV(smberrcode);\n \t}\n+\tif (err_map)\n+\t\trc = err_map->posix_code;\n \t/* else ERRHRD class errors or junk  - return EIO */\n \n \t/* special cases for NT status codes which cannot be translated to DOS codes */\n",
    "prefixes": [
        "v2",
        "10/12"
    ]
}