{"id":2234988,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2234988/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260508121539.4174601-7-libaokun@linux.alibaba.com/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.2/projects/8/?format=json","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-7-libaokun@linux.alibaba.com>","list_archive_url":null,"date":"2026-05-08T12:15:28","name":"[RFC,06/17] ext4: add ext4_block_bitmap_csum_set_range() for incremental checksum update","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"f2b1bb96ce234032ea71998f04a7648ab6849014","submitter":{"id":92757,"url":"http://patchwork.ozlabs.org/api/1.2/people/92757/?format=json","name":"Baokun Li","email":"libaokun@linux.alibaba.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260508121539.4174601-7-libaokun@linux.alibaba.com/mbox/","series":[{"id":503377,"url":"http://patchwork.ozlabs.org/api/1.2/series/503377/?format=json","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/2234988/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2234988/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <SRS0=GwPv=DF=vger.kernel.org=linux-ext4+bounces-16368-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=e+W7lInc;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=150.107.74.76; helo=mail.ozlabs.org;\n envelope-from=srs0=gwpv=df=vger.kernel.org=linux-ext4+bounces-16368-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.234.253.10 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=e+W7lInc;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16368-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=\"e+W7lInc\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=115.124.30.119","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 (gandalf.ozlabs.org [150.107.74.76])\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 4gBpBH0NbVz1yKd\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 22:21:11 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4gBpBG71Vpz4wJS\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 22:21:10 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4gBpBG6yYQz4wJg; Fri, 08 May 2026 22:21:10 +1000 (AEST)","from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\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 4gBpBC58Wvz4wJS\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 08 May 2026 22:21:07 +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 81CEA309E44A\n\tfor <patchwork-incoming@ozlabs.org>; Fri,  8 May 2026 12:16:16 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D64A33DA5B4;\n\tFri,  8 May 2026 12:16:15 +0000 (UTC)","from out30-119.freemail.mail.aliyun.com\n (out30-119.freemail.mail.aliyun.com [115.124.30.119])\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 D285318A6DB;\n\tFri,  8 May 2026 12:16:12 +0000 (UTC)","from\n x31h02109.sqa.na131.tbsite.net(mailfrom:libaokun@linux.alibaba.com\n fp:SMTPD_---0X2XQgp9_1778242563 cluster:ay36)\n          by smtp.aliyun-inc.com;\n          Fri, 08 May 2026 20:16:04 +0800"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1778242870; cv=pass;\n\tb=iHY/0HZEBAotpJMtRO2c6lEMxpTyPbAutJc2ZuNbKs5Z6d+aLMVrjqjz4YtWzPXjg76ozH2Oc8pUu//cVt6Zv5qZdT52gfclQDjv6ao6zwrN/VNJp8lMqx4VFMldAN1Tc3uxdPypf1X/g5K88W+UziKJhf9aLnP6YcZGMzpgbnCxwQArYZVI72czGP07mYrJHcrJNaNgAxNjOCc+7Ph1CZfTW2NihN0cn9L6Ee9fNMX5caBONMZMBH92pNEr4S/9JwyjPoMHAhxTu5dGzLWtIrgVNnVz8LCmj3K80elrt+Qw1k+LYOEroD1pfuuMgoDiEsxjLb90dKlcikSPeoS1Hw==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1778242575; cv=none;\n b=qN1Ndx+FMlS+9OZP8s88Z78q2XBPV9Fsn08/rIRpnQ8+rd0I0t/iDvYLt1iiQiV2xKNETt7xd2zeB/SJENUeHay3dQR0R0tMgoUoWjSdT9BfR/QCBxNbhBDp9Jx4btUvFpgMiz4o0fem40MioKsfbRQiikmUoT/ODe+dzyvOgh8="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1778242870; c=relaxed/relaxed;\n\tbh=zuuWOmJdIlo1PEaHWCpLgBtQsMQbVbjkhmxvFfLl6Mg=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=sy/6DemAcGNcGgXDHbu9zVHO8COJ8peGmbhfcTYGGpH02H5e0pSCB0ck4BjgE9JO2nT/Q5CKvHch3vgBlp0MqSWkQw2/9nrtVVJeEfLuyrapj1OG4cWeNqnC4yYR/heVX1oeKgUmZOa/6Y8ImvUWklDD8+JXGe1tG85qyb/9NDAgQHDqq9yRYn4t4JhQKKnl0HSUHhF+BrjRIvky8woqH0woM4OvgQVqgCYXE9MxVglEjrkuCW/znk87MDWoPmhwpPLvmdbYQKdPjHth5QY1bsxxun7tI8fXC6FvH8++XCOdNAAvTwAQvSehaCn2PI5ecwnMrsXv3aCEIgWZNIQN6A==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1778242575; c=relaxed/simple;\n\tbh=4G3Y6xq4wZzCXzS0j6TRGac8M0LV74cS9SY50eOOF4E=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=hqmMc31NDwm6KKnCMd9PdBCIlqmRMOCBaN3fHvTM84xAzovWSn7NuFocc5E1uTYuHtar8Z9jlAVhyWkYc38Gdp3lnq+LSGp7Q0tj6DCEsbr1L1KNem0D6gxoddsy6xl6OzqsTHR39M3mdm+2RQ5bNmwXyqRf1W8x3sQi3Nwh3ho="],"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=e+W7lInc; dkim-atps=neutral;\n spf=pass (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16368-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=e+W7lInc;\n arc=none smtp.client-ip=115.124.30.119"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linux.alibaba.com; s=default;\n\tt=1778242564; h=From:To:Subject:Date:Message-ID:MIME-Version;\n\tbh=zuuWOmJdIlo1PEaHWCpLgBtQsMQbVbjkhmxvFfLl6Mg=;\n\tb=e+W7lIncTdD12sJ1vGTkHwZsCDp4KOkNs9ViaYjbWiRirg/JiF1iz4eBb1+X9GN9bXeOMXyhp06d6lXIC814mpkmnVJSQI6NygspHsTgRtO5e7/ymw9O3+BAYQXMH9ghVqQbR3SwxYMM7kSqju8ZsNq/dw8yH03fZKx6sD9eLNU=","X-Alimail-AntiSpam":"\n AC=PASS;BC=-1|-1;BR=01201311R421e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam011083073210;MF=libaokun@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0X2XQgp9_1778242563;","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 06/17] ext4: add ext4_block_bitmap_csum_set_range() for\n incremental checksum update","Date":"Fri,  8 May 2026 20:15:28 +0800","Message-ID":"<20260508121539.4174601-7-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 a helper function ext4_block_bitmap_csum_set_range() that updates\nthe block bitmap checksum using crc32c_flip_range() for incremental CRC\ncalculation. Unlike ext4_block_bitmap_csum_set() which re-scans the\nentire bitmap buffer, this function efficiently computes the CRC delta\nfor a range of flipped bits, avoiding the cost of a full CRC\nrecalculation.\n\nSigned-off-by: Baokun Li <libaokun@linux.alibaba.com>\n---\n fs/ext4/bitmap.c | 24 ++++++++++++++++++++++++\n fs/ext4/ext4.h   |  3 +++\n 2 files changed, 27 insertions(+)","diff":"diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c\nindex 46affc9e80ca..00b0a3c74859 100644\n--- a/fs/ext4/bitmap.c\n+++ b/fs/ext4/bitmap.c\n@@ -110,3 +110,27 @@ void ext4_block_bitmap_csum_set(struct super_block *sb,\n \tcsum = ext4_chksum(sbi->s_csum_seed, (__u8 *)bh->b_data, sz);\n \text4_block_bitmap_csum_store(sb, gdp, csum);\n }\n+\n+/*\n+ * Update block bitmap checksum using incremental CRC calculation.\n+ *\n+ * This function assumes that ALL bits in the range [offset, offset+len)\n+ * have been flipped (XORed with 1). It uses crc32c_flip_range() to\n+ * efficiently compute the CRC delta without re-scanning the entire bitmap.\n+ * The csum_seed cancels out in the XOR delta, so it is not needed here.\n+ */\n+void ext4_block_bitmap_csum_set_range(struct super_block *sb,\n+\t\t\t\t      struct ext4_group_desc *gdp,\n+\t\t\t\t      ext4_grpblk_t offset, ext4_grpblk_t len)\n+{\n+\t__u32 new_csum, old_csum;\n+\n+\tif (!ext4_has_feature_metadata_csum(sb))\n+\t\treturn;\n+\n+\told_csum = ext4_block_bitmap_csum_get(sb, gdp);\n+\tnew_csum = crc32c_flip_range(old_csum, EXT4_CLUSTERS_PER_GROUP(sb),\n+\t\t\t\t     offset, len);\n+\n+\text4_block_bitmap_csum_store(sb, gdp, new_csum);\n+}\ndiff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h\nindex 94283a991e5c..c423a9a04047 100644\n--- a/fs/ext4/ext4.h\n+++ b/fs/ext4/ext4.h\n@@ -2770,6 +2770,9 @@ int ext4_inode_bitmap_csum_verify(struct super_block *sb,\n void ext4_block_bitmap_csum_set(struct super_block *sb,\n \t\t\t\tstruct ext4_group_desc *gdp,\n \t\t\t\tstruct buffer_head *bh);\n+void ext4_block_bitmap_csum_set_range(struct super_block *sb,\n+\t\t\t\t      struct ext4_group_desc *gdp,\n+\t\t\t\t      ext4_grpblk_t offset, ext4_grpblk_t len);\n int ext4_block_bitmap_csum_verify(struct super_block *sb,\n \t\t\t\t  struct ext4_group_desc *gdp,\n \t\t\t\t  struct buffer_head *bh);\n","prefixes":["RFC","06/17"]}