Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2215725/?format=api
{ "id": 2215725, "url": "http://patchwork.ozlabs.org/api/patches/2215725/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260325072850.3997161-4-yi.zhang@huaweicloud.com/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/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": "<20260325072850.3997161-4-yi.zhang@huaweicloud.com>", "list_archive_url": null, "date": "2026-03-25T07:28:42", "name": "[v2,03/10] ext4: rename and extend ext4_block_truncate_page()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "193c9350901bf6b3509a06d4df1e9af6bc35e0be", "submitter": { "id": 85428, "url": "http://patchwork.ozlabs.org/api/people/85428/?format=api", "name": "Zhang Yi", "email": "yi.zhang@huaweicloud.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260325072850.3997161-4-yi.zhang@huaweicloud.com/mbox/", "series": [ { "id": 497391, "url": "http://patchwork.ozlabs.org/api/series/497391/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=497391", "date": "2026-03-25T07:28:44", "name": "ext4: refactor partial block zero-out for iomap conversion", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/497391/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2215725/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2215725/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=nWPV=BZ=vger.kernel.org=linux-ext4+bounces-15332-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 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=nwpv=bz=vger.kernel.org=linux-ext4+bounces-15332-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=none (p=none dis=none) header.from=huaweicloud.com", "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-15332-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=45.249.212.56", "smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=huaweicloud.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 4fgdyF1jzNz1y1G\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 18:36:37 +1100 (AEDT)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fgdyF1Ggpz4wCG\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 18:36:37 +1100 (AEDT)", "by gandalf.ozlabs.org (Postfix)\n\tid 4fgdyF1CWJz4wF0; Wed, 25 Mar 2026 18:36:37 +1100 (AEDT)", "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 4fgdy95Nlnz4wCG\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 25 Mar 2026 18:36:33 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id E997430ADB97\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 25 Mar 2026 07:34:18 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 6DC15371D1A;\n\tWed, 25 Mar 2026 07:33:49 +0000 (UTC)", "from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com\n [45.249.212.56])\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 996C436E497;\n\tWed, 25 Mar 2026 07:33:46 +0000 (UTC)", "from mail.maildlp.com (unknown [172.19.163.177])\n\tby dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4fgdt4723PzKHMZ7;\n\tWed, 25 Mar 2026 15:33:00 +0800 (CST)", "from mail02.huawei.com (unknown [10.116.40.112])\n\tby mail.maildlp.com (Postfix) with ESMTP id 5477A4058C;\n\tWed, 25 Mar 2026 15:33:39 +0800 (CST)", "from huaweicloud.com (unknown [10.50.85.155])\n\tby APP1 (Coremail) with SMTP id cCh0CgAHC9vFj8NpuR6cCA--.49898S7;\n\tWed, 25 Mar 2026 15:33:39 +0800 (CST)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1774424197; cv=pass;\n\tb=s0Q7ChUOOCODyVfRqg+bxHY6FJ7r9jnYxNPQqEJ18V0oKSh/czm132M4IdIQ/14jgDBxclg7MSGXb7CmYpz/bo+5UdyVgvT9jn9Z5T16wubCw66Ts5GOAfNlYqFZ5bHsqghUPM6qmoVn0HBqxx9JmFZ8GLlpkqCgBJ5jIlHglanKWnE02BITXYtDBL6qM4bENzM1Rv4aOJVgcaPKL7L/6lEkafOc2WJmRB43PcCRG4xWW2N0fjqDY8qqjkUXeYk2bFF9PWIWFmte/ACIyAgTJH1Qmrp79J+DeEgzd33c9ARzBKh8TpwX5KySzyk8jBSkBIMZ/TRx/8Fxi2hMukDVIA==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774424029; cv=none;\n b=qAmHOdaM5PpHS3qO0lRmztDNuY2/4j0I2pZLYzTxEcWGt86rU/a4KobfEOA+ZJktc+AOp3AMHONkD1BNdnlZTxKgcrA4+/SSl457o/7bctY2ND8Q1yl8TGbdb3TPyNYJFNKHv2qa1bzIjr9MuGGh0RkN71KO6CrQh9tPJ4Vdcl8=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1774424197; c=relaxed/relaxed;\n\tbh=Nh78++id/Qp+E6iVXahlub9lHged7g3/rfNZlfHOBNU=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=DIoKURCQ0nP2j5gPEb/V/qxpbVR24qJxuo9z+B/MDVzzKJrdeaw6j1fidv9ACKKDHRzXI3QbxOaQvDm1u004FhYUtrN69i2dGGg5A/XE+MlanPGH92uWmhyAJEFfMfN6w7SoPygGXLe27nqUc6wgYqQEJDb7NF3m914CFf+2nNbDqXVhuPYnO7letIo9F/0onmJ2SaWxqBbokSadbpkXcZ+MFoSuz5pRXzFs0fLTySdtr3zIV5wjLtgPGWW+RweAKasI9UK216TFTVZh5G/RzEwovqyGT0Sa1cNdaxS8GrQux0v9sHK6rqa1NdtNyWwRKu2F5layzMSJ5X3uc/d2+g==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774424029; c=relaxed/simple;\n\tbh=Ah36djBNwxzvj7sWKIwEZeGJjPmY2z1pFBAz+ykL2Is=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=CqKBXZuSxZ5VTBx3CBbL5x0Jz0Q4iYzQ0WjhScWvjdCBf2rPyRUlBBFfcMSY7Zc6sv8ldzQwCmEqr9h/AUjBwZZYyWJWrwqJoWClPFAYf4C8VaSCWTEADadSpL+xCiy+YqwefPvqLMF8EJa+ltmUOp9Z4mBc8OlatU8eXfDCB7U=" ], "ARC-Authentication-Results": [ "i=2; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15332-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56" ], "From": "Zhang Yi <yi.zhang@huaweicloud.com>", "To": "linux-ext4@vger.kernel.org", "Cc": "linux-fsdevel@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\ttytso@mit.edu,\n\tadilger.kernel@dilger.ca,\n\tjack@suse.cz,\n\tojaswin@linux.ibm.com,\n\tritesh.list@gmail.com,\n\tlibaokun@linux.alibaba.com,\n\tyi.zhang@huawei.com,\n\tyi.zhang@huaweicloud.com,\n\tyizhang089@gmail.com,\n\tyangerkun@huawei.com,\n\tyukuai@fnnas.com", "Subject": "[PATCH v2 03/10] ext4: rename and extend ext4_block_truncate_page()", "Date": "Wed, 25 Mar 2026 15:28:42 +0800", "Message-ID": "<20260325072850.3997161-4-yi.zhang@huaweicloud.com>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260325072850.3997161-1-yi.zhang@huaweicloud.com>", "References": "<20260325072850.3997161-1-yi.zhang@huaweicloud.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-CM-TRANSID": "cCh0CgAHC9vFj8NpuR6cCA--.49898S7", "X-Coremail-Antispam": "1UD129KBjvJXoW3XF18Ar15tF17Gw1xJrW3trb_yoW7tryUp3\n\t4ayw15Cr1j9ryq9F4IgFsrXr4a93WkGF4UWrWfKryrZasrXF1xKF1DtFyrtFWjqrW7Xa1j\n\tqFs8KrWjgw17J3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDU0xBIdaVrnRJUUUmY14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0\n\trVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JrWl82xGYIkIc2\n\tx26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0\n\tY4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw\n\tA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS\n\t0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2\n\tIY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0\n\tY48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2\n\txKxwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWU\n\tJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67\n\tkF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY\n\t6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42\n\tIY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIev\n\tJa73UjIFyTuYvjfUF3kuDUUUU", "X-CM-SenderInfo": "d1lo6xhdqjqx5xdzvxpfor3voofrz/", "X-Spam-Status": "No, score=-1.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,\n\tSPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org" }, "content": "From: Zhang Yi <yi.zhang@huawei.com>\n\nRename ext4_block_truncate_page() to ext4_block_zero_eof() and extend\nits signature to accept an explicit 'end' offset instead of calculating\nthe block boundary. This helper function now can replace all cases\nrequiring zeroing of the partial EOF block, including the append\nbuffered write paths in ext4_*_write_end().\n\nSigned-off-by: Zhang Yi <yi.zhang@huawei.com>\nReviewed-by: Jan Kara <jack@suse.cz>\n---\n fs/ext4/ext4.h | 2 ++\n fs/ext4/extents.c | 4 ++--\n fs/ext4/inode.c | 43 +++++++++++++++++++++++--------------------\n 3 files changed, 27 insertions(+), 22 deletions(-)", "diff": "diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h\nindex 293f698b7042..c62459ef9796 100644\n--- a/fs/ext4/ext4.h\n+++ b/fs/ext4/ext4.h\n@@ -3099,6 +3099,8 @@ extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);\n extern int ext4_chunk_trans_extent(struct inode *inode, int nrblocks);\n extern int ext4_meta_trans_blocks(struct inode *inode, int lblocks,\n \t\t\t\t int pextents);\n+extern int ext4_block_zero_eof(handle_t *handle, struct inode *inode,\n+\t\t\t loff_t from, loff_t end);\n extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,\n \t\t\t loff_t lstart, loff_t lend);\n extern vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf);\ndiff --git a/fs/ext4/extents.c b/fs/ext4/extents.c\nindex ae3804f36535..a265070c1b79 100644\n--- a/fs/ext4/extents.c\n+++ b/fs/ext4/extents.c\n@@ -4625,8 +4625,8 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset,\n \t\t\t\t\t\t inode_get_ctime(inode));\n \t\t\tif (epos > old_size) {\n \t\t\t\tpagecache_isize_extended(inode, old_size, epos);\n-\t\t\t\text4_zero_partial_blocks(handle, inode,\n-\t\t\t\t\t\t old_size, epos - old_size);\n+\t\t\t\text4_block_zero_eof(handle, inode, old_size,\n+\t\t\t\t\t\t epos);\n \t\t\t}\n \t\t}\n \t\tret2 = ext4_mark_inode_dirty(handle, inode);\ndiff --git a/fs/ext4/inode.c b/fs/ext4/inode.c\nindex f21be26b4642..a7635bbac1a0 100644\n--- a/fs/ext4/inode.c\n+++ b/fs/ext4/inode.c\n@@ -1458,7 +1458,7 @@ static int ext4_write_end(const struct kiocb *iocb,\n \n \tif (old_size < pos && !verity) {\n \t\tpagecache_isize_extended(inode, old_size, pos);\n-\t\text4_zero_partial_blocks(handle, inode, old_size, pos - old_size);\n+\t\text4_block_zero_eof(handle, inode, old_size, pos);\n \t}\n \t/*\n \t * Don't mark the inode dirty under folio lock. First, it unnecessarily\n@@ -1576,7 +1576,7 @@ static int ext4_journalled_write_end(const struct kiocb *iocb,\n \n \tif (old_size < pos && !verity) {\n \t\tpagecache_isize_extended(inode, old_size, pos);\n-\t\text4_zero_partial_blocks(handle, inode, old_size, pos - old_size);\n+\t\text4_block_zero_eof(handle, inode, old_size, pos);\n \t}\n \n \tif (size_changed) {\n@@ -3252,7 +3252,7 @@ static int ext4_da_do_write_end(struct address_space *mapping,\n \tif (IS_ERR(handle))\n \t\treturn PTR_ERR(handle);\n \tif (zero_len)\n-\t\text4_zero_partial_blocks(handle, inode, old_size, zero_len);\n+\t\text4_block_zero_eof(handle, inode, old_size, pos);\n \text4_mark_inode_dirty(handle, inode);\n \text4_journal_stop(handle);\n \n@@ -4132,29 +4132,32 @@ static int ext4_block_zero_page_range(handle_t *handle,\n }\n \n /*\n- * ext4_block_truncate_page() zeroes out a mapping from file offset `from'\n- * up to the end of the block which corresponds to `from'.\n- * This required during truncate. We need to physically zero the tail end\n- * of that block so it doesn't yield old data if the file is later grown.\n- * Return the zeroed length on success.\n+ * Zero out a mapping from file offset 'from' up to the end of the block\n+ * which corresponds to 'from' or to the given 'end' inside this block.\n+ * This required during truncate up and performing append writes. We need\n+ * to physically zero the tail end of that block so it doesn't yield old\n+ * data if the file is grown. Return the zeroed length on success.\n */\n-static int ext4_block_truncate_page(handle_t *handle,\n-\t\tstruct address_space *mapping, loff_t from)\n+int ext4_block_zero_eof(handle_t *handle, struct inode *inode,\n+\t\t\tloff_t from, loff_t end)\n {\n-\tunsigned length;\n-\tunsigned blocksize;\n-\tstruct inode *inode = mapping->host;\n+\tunsigned int blocksize = i_blocksize(inode);\n+\tunsigned int offset;\n+\tloff_t length = end - from;\n \tbool did_zero = false;\n \tint err;\n \n+\toffset = from & (blocksize - 1);\n+\tif (!offset || from >= end)\n+\t\treturn 0;\n \t/* If we are processing an encrypted inode during orphan list handling */\n \tif (IS_ENCRYPTED(inode) && !fscrypt_has_encryption_key(inode))\n \t\treturn 0;\n \n-\tblocksize = i_blocksize(inode);\n-\tlength = blocksize - (from & (blocksize - 1));\n+\tif (length > blocksize - offset)\n+\t\tlength = blocksize - offset;\n \n-\terr = ext4_block_zero_page_range(handle, mapping, from, length,\n+\terr = ext4_block_zero_page_range(handle, inode->i_mapping, from, length,\n \t\t\t\t\t &did_zero);\n \tif (err)\n \t\treturn err;\n@@ -4508,7 +4511,6 @@ int ext4_truncate(struct inode *inode)\n \tunsigned int credits;\n \tint err = 0, err2;\n \thandle_t *handle;\n-\tstruct address_space *mapping = inode->i_mapping;\n \n \t/*\n \t * There is a possibility that we're either freeing the inode\n@@ -4551,8 +4553,9 @@ int ext4_truncate(struct inode *inode)\n \t\tgoto out_trace;\n \t}\n \n+\t/* Zero to the end of the block containing i_size */\n \tif (inode->i_size & (inode->i_sb->s_blocksize - 1))\n-\t\text4_block_truncate_page(handle, mapping, inode->i_size);\n+\t\text4_block_zero_eof(handle, inode, inode->i_size, LLONG_MAX);\n \n \t/*\n \t * We add the inode to the orphan list, so that if this\n@@ -5929,8 +5932,8 @@ int ext4_setattr(struct mnt_idmap *idmap, struct dentry *dentry,\n \t\t\t\tinode_set_mtime_to_ts(inode,\n \t\t\t\t\t\t inode_set_ctime_current(inode));\n \t\t\t\tif (oldsize & (inode->i_sb->s_blocksize - 1))\n-\t\t\t\t\text4_block_truncate_page(handle,\n-\t\t\t\t\t\t\tinode->i_mapping, oldsize);\n+\t\t\t\t\text4_block_zero_eof(handle, inode,\n+\t\t\t\t\t\t\t oldsize, LLONG_MAX);\n \t\t\t}\n \n \t\t\tif (shrink)\n", "prefixes": [ "v2", "03/10" ] }