Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2234987/?format=api
{ "id": 2234987, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2234987/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260508121539.4174601-3-libaokun@linux.alibaba.com/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/1.2/projects/8/?format=api", "name": "Linux ext4 filesystem development", "link_name": "linux-ext4", "list_id": "linux-ext4.vger.kernel.org", "list_email": "linux-ext4@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260508121539.4174601-3-libaokun@linux.alibaba.com>", "list_archive_url": null, "date": "2026-05-08T12:15:24", "name": "[RFC,02/17] lib/crc: crc_kunit: add kunit test for crc32c_flip_range()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d356829c9cb6f2278249415f646a40a9016a139f", "submitter": { "id": 92757, "url": "http://patchwork.ozlabs.org/api/1.2/people/92757/?format=api", "name": "Baokun Li", "email": "libaokun@linux.alibaba.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260508121539.4174601-3-libaokun@linux.alibaba.com/mbox/", "series": [ { "id": 503377, "url": "http://patchwork.ozlabs.org/api/1.2/series/503377/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=503377", "date": "2026-05-08T12:15:22", "name": "ext4/lib-crc: LBS performance part 1 - incremental CRC32c for bitmap checksums", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/503377/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2234987/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2234987/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=mYBQ=DF=vger.kernel.org=linux-ext4+bounces-16367-patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-ext4@vger.kernel.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "patchwork-incoming@ozlabs.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com\n header.a=rsa-sha256 header.s=default header.b=V1t2o2KI;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=mybq=df=vger.kernel.org=linux-ext4+bounces-16367-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c0a:e001:db::12fc:5321\"\n arc.chain=subspace.kernel.org", "gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.alibaba.com", "gandalf.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com\n header.a=rsa-sha256 header.s=default header.b=V1t2o2KI;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16367-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux.alibaba.com\n header.i=@linux.alibaba.com header.b=\"V1t2o2KI\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=115.124.30.133", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.alibaba.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.alibaba.com" ], "Received": [ "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\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 4gBpB648Y8z1yKd\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 22:21:02 +1000 (AEST)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4gBpB63bWTz4wJg\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 22:21:02 +1000 (AEST)", "by gandalf.ozlabs.org (Postfix)\n\tid 4gBpB63WQFz4wJS; Fri, 08 May 2026 22:21:02 +1000 (AEST)", "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::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 gandalf.ozlabs.org (Postfix) with ESMTPS id 4gBpB264Bhz4wJg\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 08 May 2026 22:20:58 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 01659309BFA8\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 8 May 2026 12:16:15 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id B09C03DB652;\n\tFri, 8 May 2026 12:16:15 +0000 (UTC)", "from out30-133.freemail.mail.aliyun.com\n (out30-133.freemail.mail.aliyun.com [115.124.30.133])\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 0B8B8317167;\n\tFri, 8 May 2026 12:16:09 +0000 (UTC)", "from\n x31h02109.sqa.na131.tbsite.net(mailfrom:libaokun@linux.alibaba.com\n fp:SMTPD_---0X2XQgnl_1778242560 cluster:ay36)\n by smtp.aliyun-inc.com;\n Fri, 08 May 2026 20:16:00 +0800" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1778242862; cv=pass;\n\tb=Ivsn0sqSSE6cohzthF2xEiwUVgItKiKablkZapEX5KWLZPLEWnRw2r4Iy8KtGqdqJJ0f1hTZaQv/3MJTV7/6XtQYLr/PwVTbVgLUgQ/BN4l006Hm8rHmZSZrhUwvHZoxHgqI4itoe+yL6Z4fSgy1HLGpuJPr0g+d8PEcWtLqvQLVGwN10XW6+HgpOFWcOy7/8z3UdBK9vcdd9iucPrpRtYueFs2oxvjgx3+aco0DfXBaJGkq7+7uN+ch2UyPCU7Gfhv3nbfWsXiGqScunBW+jEFM1z7/IdURanXzWyy+Ze7giIaZ0HAwuX2H9U+NYa3gpsyOhIlELGtFpuWn3qtapA==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1778242575; cv=none;\n b=u8o2jktEBANncAtxGSoY5Iirbr0wVzxS/yf1uPDc0tCbqFM6wEDVGM48YBX5l/JpbnnkdGOk1tx/oOZh7lUYeKd8QiYlHf3pkfDL3n73zHYWGhL/bdeZVN/vbxBcSUmArPcp6aQ4VXSIfkfPhQpqUpZ3jDiJprIFMVp0VWV9r0U=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1778242862; c=relaxed/relaxed;\n\tbh=MrEYE1T1bmers4GpxJo71+7yS7QaAHf/z3ZcYCpLD80=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=BURFyR9PogmA0nd1LoY1+RuhGd+kFQWdJUsdMPSjzuYev4PTuAuP2STVW2C6TPUGqw4DVDwmKKAuUAkm5rXx/XXqCaaNxfjNNR917fzZFpRMDoJn381FTLoQPyVnPvzXIyKB2bRqQVcYDgR0JHxx7EzZMYWTZyB+zBTw8Y5qwuoMbQd5yc7Cc7gBD1RZ0sQKeTL02HO83JFEXhEgmx8cERulTDAdlv1kW+ALPo0CGZ9B1Ie7atDxlafv7evce63K9PwL4Yszv4F03EvyFkUuxSQxrVcwlYBcRsBJ//LqHee3IyvbAkQj8JPY538J2iTJvCiUluBmwITQ402tBW7H7A==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1778242575; c=relaxed/simple;\n\tbh=HN2Y0oSr2no+o0YAxTU4luc1gJdMzXkybzkEc45bndE=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=taplGCyhql/aJGCuxUFRbiVqgt//H97YL4kySet3EfxVx9TBZILjPY6rdrZIOl0drmqmqlW2ehiXdsmt1AWrv8aUGA81VU8XBMAd8JAlU/GQ7o9aabjvF6sE/4GCt/H4eQjJB4FUo2e7mtYR11m4GtZthoHDXvoO25mRkNYCcV0=" ], "ARC-Authentication-Results": [ "i=2; gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.alibaba.com;\n dkim=pass (1024-bit key;\n unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com\n header.a=rsa-sha256 header.s=default header.b=V1t2o2KI; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16367-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.alibaba.com;\n spf=pass smtp.mailfrom=linux.alibaba.com;\n dkim=pass (1024-bit key) header.d=linux.alibaba.com\n header.i=@linux.alibaba.com header.b=V1t2o2KI;\n arc=none smtp.client-ip=115.124.30.133" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linux.alibaba.com; s=default;\n\tt=1778242561; h=From:To:Subject:Date:Message-ID:MIME-Version;\n\tbh=MrEYE1T1bmers4GpxJo71+7yS7QaAHf/z3ZcYCpLD80=;\n\tb=V1t2o2KIkzS6HWNveVAwKINcWvyvd64fiSWzHwS/CxuYFvMC/2H1WgBzbmuf2VyzC8JPUnWt9zvs0+9S72iQBCwaCKPx2FDJ9kE3YLHVOxLxkVkxOKdDmoUUfTaM+/CH/TwZCooFa9t62qoelIn7WtzBXDyCsOo0VeO0KKqq+s0=", "X-Alimail-AntiSpam": "\n AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=libaokun@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0X2XQgnl_1778242560;", "From": "Baokun Li <libaokun@linux.alibaba.com>", "To": "linux-ext4@vger.kernel.org", "Cc": "linux-crypto@vger.kernel.org,\n\tebiggers@kernel.org,\n\tardb@kernel.org,\n\ttytso@mit.edu,\n\tadilger.kernel@dilger.ca,\n\tjack@suse.cz,\n\tyi.zhang@huawei.com,\n\tojaswin@linux.ibm.com,\n\tritesh.list@gmail.com,\n\tBaokun Li <libaokun@linux.alibaba.com>", "Subject": "[PATCH RFC 02/17] lib/crc: crc_kunit: add kunit test for\n crc32c_flip_range()", "Date": "Fri, 8 May 2026 20:15:24 +0800", "Message-ID": "<20260508121539.4174601-3-libaokun@linux.alibaba.com>", "X-Mailer": "git-send-email 2.43.7", "In-Reply-To": "<20260508121539.4174601-1-libaokun@linux.alibaba.com>", "References": "<20260508121539.4174601-1-libaokun@linux.alibaba.com>", "Precedence": "bulk", "X-Mailing-List": "linux-ext4@vger.kernel.org", "List-Id": "<linux-ext4.vger.kernel.org>", "List-Subscribe": "<mailto:linux-ext4+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-ext4+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Spam-Status": "No, score=-8.7 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tHEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,\n\tSPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_DKIM_WL autolearn=disabled\n\tversion=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org" }, "content": "Add kunit tests for crc32c_flip_range(), validating correctness\nagainst naive full-buffer CRC recomputation. All tests use a 64KB\nbuffer and a non-zero CRC seed to match real-world usage (e.g. ext4\nmetadata checksums):\n\n - ones_lookup[0] single-bit verification.\n - num_bits=0 no-op, first/last byte, full 64KB flip.\n - Random single-bit flips (100 iterations).\n - Random multi-bit contiguous ranges (100 iterations).\n\nSigned-off-by: Baokun Li <libaokun@linux.alibaba.com>\n---\n lib/crc/tests/crc_kunit.c | 85 +++++++++++++++++++++++++++++++++++++++\n 1 file changed, 85 insertions(+)", "diff": "diff --git a/lib/crc/tests/crc_kunit.c b/lib/crc/tests/crc_kunit.c\nindex 9428cd913625..46f9df5b58e4 100644\n--- a/lib/crc/tests/crc_kunit.c\n+++ b/lib/crc/tests/crc_kunit.c\n@@ -470,6 +470,90 @@ static void crc64_nvme_benchmark(struct kunit *test)\n }\n #endif /* CONFIG_CRC64 */\n \n+/*\n+ * Test crc32c_flip_range() against naive full-buffer CRC recomputation.\n+ * All tests use a 64KB buffer (2^19 bits = INCR_MAX_ORDER limit)\n+ * and a non-zero seed to match real-world usage (e.g. ext4 checksums).\n+ */\n+static void crc32c_flip_range_test(struct kunit *test)\n+{\n+\tsize_t buflen = 65536;\n+\tsize_t total_bits = buflen * 8;\n+\tu32 seed = 0x12345678;\n+\tu32 expected, flip_crc;\n+\tsize_t start, num_bits, b, pos;\n+\tu8 *buf;\n+\tint i;\n+\n+\tbuf = kunit_kmalloc(test, buflen, GFP_KERNEL);\n+\tKUNIT_ASSERT_NOT_NULL(test, buf);\n+\n+\t/* Test 1: Single bit at bit 0 (verifies ones_lookup[0]) */\n+\tbuf[0] = 0x00;\n+\texpected = crc32c(seed, buf, 1);\n+\tbuf[0] = 0x01;\n+\tflip_crc = crc32c_flip_range(expected, 8, 0, 1);\n+\texpected = crc32c(seed, buf, 1);\n+\tKUNIT_ASSERT_EQ_MSG(test, expected, flip_crc, \"Single bit at bit 0\");\n+\n+\t/* Test 2: num_bits=0 should be a no-op */\n+\tmemset(buf, 0, buflen);\n+\texpected = crc32c(seed, buf, buflen);\n+\tflip_crc = crc32c_flip_range(expected, total_bits, 0, 0);\n+\tKUNIT_ASSERT_EQ_MSG(test, expected, flip_crc,\n+\t\t\t \"num_bits=0: expected=0x%08x got=0x%08x\",\n+\t\t\t expected, flip_crc);\n+\n+\t/* Test 3: Boundary flips - first byte, last byte, all bits */\n+\tbuf[0] = 0xFF;\n+\tflip_crc = crc32c_flip_range(expected, total_bits, 0, 8);\n+\texpected = crc32c(seed, buf, buflen);\n+\tKUNIT_ASSERT_EQ_MSG(test, expected, flip_crc, \"Flip first byte\");\n+\n+\tbuf[buflen - 1] = 0xFF;\n+\tflip_crc = crc32c_flip_range(expected, total_bits, (buflen - 1) * 8, 8);\n+\texpected = crc32c(seed, buf, buflen);\n+\tKUNIT_ASSERT_EQ_MSG(test, expected, flip_crc, \"Flip last byte\");\n+\n+\tmemset(buf, 0, buflen);\n+\texpected = crc32c(seed, buf, buflen);\n+\tmemset(buf, 0xFF, buflen);\n+\tflip_crc = crc32c_flip_range(expected, total_bits, 0, total_bits);\n+\texpected = crc32c(seed, buf, buflen);\n+\tKUNIT_ASSERT_EQ_MSG(test, expected, flip_crc, \"Flip all 64KB bits\");\n+\n+\t/* Test 4: Random single-bit flips (100 iterations) */\n+\tmemset(buf, 0, buflen);\n+\texpected = crc32c(seed, buf, buflen);\n+\tfor (i = 0; i < 100; i++) {\n+\t\tstart = rand32() % total_bits;\n+\t\tbuf[start / 8] ^= (1 << (start % 8));\n+\n+\t\tflip_crc = crc32c_flip_range(expected, total_bits, start, 1);\n+\t\texpected = crc32c(seed, buf, buflen);\n+\t\tKUNIT_ASSERT_EQ_MSG(test, expected, flip_crc,\n+\t\t\t\t \"Single bit at %zu: expected=0x%08x got=0x%08x\",\n+\t\t\t\t start, expected, flip_crc);\n+\t}\n+\n+\t/* Test 5: Random multi-bit ranges (100 iterations) */\n+\tfor (i = 0; i < 100; i++) {\n+\t\tnum_bits = (rand32() % (total_bits - 1)) + 1;\n+\t\tstart = rand32() % (total_bits - num_bits + 1);\n+\t\tfor (b = 0; b < num_bits; b++) {\n+\t\t\tpos = start + b;\n+\t\t\tbuf[pos / 8] ^= (1 << (pos % 8));\n+\t\t}\n+\n+\t\tflip_crc = crc32c_flip_range(expected, total_bits, start, num_bits);\n+\t\texpected = crc32c(seed, buf, buflen);\n+\n+\t\tKUNIT_ASSERT_EQ_MSG(test, expected, flip_crc,\n+\t\t\t\t \"Range [%zu, +%zu): expected=0x%08x got=0x%08x\",\n+\t\t\t\t start, num_bits, expected, flip_crc);\n+\t}\n+}\n+\n static struct kunit_case crc_test_cases[] = {\n #if IS_REACHABLE(CONFIG_CRC7)\n \tKUNIT_CASE(crc7_be_test),\n@@ -490,6 +574,7 @@ static struct kunit_case crc_test_cases[] = {\n \tKUNIT_CASE(crc32_be_benchmark),\n \tKUNIT_CASE(crc32c_test),\n \tKUNIT_CASE(crc32c_benchmark),\n+\tKUNIT_CASE(crc32c_flip_range_test),\n #endif\n #if IS_REACHABLE(CONFIG_CRC64)\n \tKUNIT_CASE(crc64_be_test),\n", "prefixes": [ "RFC", "02/17" ] }