Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216837/?format=api
{ "id": 2216837, "url": "http://patchwork.ozlabs.org/api/patches/2216837/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260327102939.1095257-13-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": "<20260327102939.1095257-13-yi.zhang@huaweicloud.com>", "list_archive_url": null, "date": "2026-03-27T10:29:38", "name": "[v4,12/13] ext4: move pagecache_isize_extended() out of active handle", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "2c62b8a43449abb4967c4e68bdc5534370c429df", "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/20260327102939.1095257-13-yi.zhang@huaweicloud.com/mbox/", "series": [ { "id": 497742, "url": "http://patchwork.ozlabs.org/api/series/497742/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=497742", "date": "2026-03-27T10:29:26", "name": "ext4: refactor partial block zero-out for iomap conversion", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/497742/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216837/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216837/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=4Lbm=B3=vger.kernel.org=linux-ext4+bounces-15489-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=4lbm=b3=vger.kernel.org=linux-ext4+bounces-15489-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.232.135.74 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.232.135.74; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15489-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 4fhxsj3Vsvz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 21:37:13 +1100 (AEDT)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fhxsj3233z4wCG\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 21:37:13 +1100 (AEDT)", "by gandalf.ozlabs.org (Postfix)\n\tid 4fhxsj2xFjz4wBB; Fri, 27 Mar 2026 21:37:13 +1100 (AEDT)", "from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])\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 4fhxsd5MGrz4wCG\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 27 Mar 2026 21:37:09 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 235F1305AB8C\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 27 Mar 2026 10:35:56 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E23B53DE420;\n\tFri, 27 Mar 2026 10:34:41 +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 8A9803A9636;\n\tFri, 27 Mar 2026 10:34:34 +0000 (UTC)", "from mail.maildlp.com (unknown [172.19.163.177])\n\tby dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4fhxnq1hlMzKHMds;\n\tFri, 27 Mar 2026 18:33:51 +0800 (CST)", "from mail02.huawei.com (unknown [10.116.40.112])\n\tby mail.maildlp.com (Postfix) with ESMTP id E112A40596;\n\tFri, 27 Mar 2026 18:34:32 +0800 (CST)", "from huaweicloud.com (unknown [10.50.85.155])\n\tby APP1 (Coremail) with SMTP id cCh0CgC3utouXcZp_T2cCQ--.28730S16;\n\tFri, 27 Mar 2026 18:34:32 +0800 (CST)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1774607833; cv=pass;\n\tb=D52Li5UDXG4CalKgxFk3H9QwiTNzTSA3PWMA7GR93froP6Lq8RUHbRhwSeLZX5hUHzxrofSOgh++14aLo1UFKUqnjrwuskIrkk9N2u7hWGx3gJFW2cEO5841YMK+nHyxUd4hrXFYG5852XpdxSePDKhPCQzI1+Vj0PKARM2VbUQxM3mjNbAe1um0Oa97GqlAJzwrvg7DvR0k/sfE06LL50vkiKShqrkp45AeAV2kIsRVWh7XvTYFUVVbLGP8zdpBjr1YCv5Xex2pCZBQ1+DigMgtTlan/hSTsk6SGtzA9BDek3RWOhsA44Yc303peZ1LB5EpjYqy54jopScMJJHqjw==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774607680; cv=none;\n b=IWxDWabzjbYG4sp61BxSaGvQ6cwDlmadZ4j/MuC4Mc+AMzC1wblQg5wb+wcI/HdfzolzL5Y0gL22k4fwt3lktB6hgMPx9Dq6PB02qjrkpOqOsQLiT/77TTg2fKELtb6khr1qLZwUu0I2f4030vwdyd1On8GDqMEfTa1K4XFOBgY=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1774607833; c=relaxed/relaxed;\n\tbh=8dA/g/tegLy7ooPGvfne8mIOfvmj2RT81XLW5Ffvb5M=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=sWg9cqtDuTDOteA83HztK+qhHldaJOvGmoTtTHc7HHa4s0zFxZOEkxew7EGysLwovIK7J0Edz8uwHPf2WzZyA/rtPMI8x5e57enYNTkjjOO6yCgVUb5wNEyVCGlpH8vYLhDueUQqzDtnTMUHUUxFtuwkcDzTvBiTlGRtt1qKqn5WV+o6TS9NU5AiF005c/wP4dH+AzVe2lvsQt/FAwGIefElCyoYkTZzXKON+wL9vnWHwFcqKZRG6rNG4gvJpIJ1coowfqxM2fUV1NhLP2edCLbSO8KDxbo+jgdJ0qd3/KxXNBanNe0zvOP07fP2l2wyRmAHyFG4fnc3hio/3ATKxA==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774607680; c=relaxed/simple;\n\tbh=3KQAjTexdz03Het2sU0IPCHZadGHhf7+7gZl/XOiIFw=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=Gyh4/1WZIb+vvVaLoUE8HxTzfEHq1FBN4reWArg/J4M8ptS/6SZZhI5G7FWDJIp9OW3Xd+i2dGHihlY1gVG+XFOGE5LsOVoj5CtSaj+Fml+ygbN1KITmMLl+7UqYBqGcOMcBLSoXxB+i/T51rJ4EN9BHK6AXGTCZxrNKoi4gH7U=" ], "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.232.135.74; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15489-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 v4 12/13] ext4: move pagecache_isize_extended() out of active\n handle", "Date": "Fri, 27 Mar 2026 18:29:38 +0800", "Message-ID": "<20260327102939.1095257-13-yi.zhang@huaweicloud.com>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260327102939.1095257-1-yi.zhang@huaweicloud.com>", "References": "<20260327102939.1095257-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": "cCh0CgC3utouXcZp_T2cCQ--.28730S16", "X-Coremail-Antispam": "1UD129KBjvJXoWxJFy3Xr1fKr1rAw15Gw18Grg_yoWrJFyfpr\n\tW3CF1FyF1FgFyv9rsayr4DZr4Yga48KrWUXr93Wr9Yv3ZxXw1fKryYyFyFvFW5trW8XF4Y\n\tqr4Dt345G3WUA3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDU0xBIdaVrnRJUUUmS14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0\n\trVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI\n\tkIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2\n\tz4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F\n\t4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq\n\t3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7\n\tIYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U\n\tM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2\n\tkIc2xKxwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkE\n\tbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67\n\tAF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVW8JVW5JwCI\n\t42IY6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF\n\t4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYxBI\n\tdaVFxhVjvjDU0xZFpf9x0JUWMKtUUUUU=", "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\nIn ext4_alloc_file_blocks(), pagecache_isize_extended() is called under\nan active handle and may also hold folio lock if the block size is\nsmaller than the folio size. This also breaks the \"folio lock ->\ntransaction start\" lock ordering for the upcoming iomap buffered I/O\npath.\n\nTherefore, move pagecache_isize_extended() outside of an active handle.\nAdditionally, it is unnecessary to update the file length during each\niteration of the allocation loop. Instead, update the file length only\nto the position where the allocation is successful. Postpone updating\nthe inode size until after the allocation loop completes or is\ninterrupted due to an error.\n\nSigned-off-by: Zhang Yi <yi.zhang@huawei.com>\n---\n fs/ext4/extents.c | 62 +++++++++++++++++++++++++++++------------------\n 1 file changed, 39 insertions(+), 23 deletions(-)", "diff": "diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c\nindex 7abe47f923c0..f13f604b1f67 100644\n--- a/fs/ext4/extents.c\n+++ b/fs/ext4/extents.c\n@@ -4553,7 +4553,7 @@ static int ext4_alloc_file_blocks(struct file *file, loff_t offset, loff_t len,\n \text4_lblk_t len_lblk;\n \tstruct ext4_map_blocks map;\n \tunsigned int credits;\n-\tloff_t epos, old_size = i_size_read(inode);\n+\tloff_t epos = 0, old_size = i_size_read(inode);\n \tunsigned int blkbits = inode->i_blkbits;\n \tbool alloc_zero = false;\n \n@@ -4618,44 +4618,60 @@ static int ext4_alloc_file_blocks(struct file *file, loff_t offset, loff_t len,\n \t\t\text4_journal_stop(handle);\n \t\t\tbreak;\n \t\t}\n+\t\text4_update_inode_fsync_trans(handle, inode, 1);\n+\t\tret = ext4_journal_stop(handle);\n+\t\tif (unlikely(ret))\n+\t\t\tbreak;\n+\n \t\t/*\n \t\t * allow a full retry cycle for any remaining allocations\n \t\t */\n \t\tretries = 0;\n-\t\tepos = EXT4_LBLK_TO_B(inode, map.m_lblk + ret);\n-\t\tif (new_size) {\n-\t\t\tif (epos > new_size)\n-\t\t\t\tepos = new_size;\n-\t\t\text4_update_inode_size(inode, epos);\n-\t\t\tif (epos > old_size)\n-\t\t\t\tpagecache_isize_extended(inode, old_size, epos);\n-\t\t}\n-\t\tret2 = ext4_mark_inode_dirty(handle, inode);\n-\t\text4_update_inode_fsync_trans(handle, inode, 1);\n-\t\tret3 = ext4_journal_stop(handle);\n-\t\tret2 = ret3 ? ret3 : ret2;\n-\t\tif (unlikely(ret2))\n-\t\t\tbreak;\n \n \t\tif (alloc_zero &&\n \t\t (map.m_flags & (EXT4_MAP_MAPPED | EXT4_MAP_UNWRITTEN))) {\n-\t\t\tret2 = ext4_issue_zeroout(inode, map.m_lblk, map.m_pblk,\n-\t\t\t\t\t\t map.m_len);\n-\t\t\tif (likely(!ret2))\n-\t\t\t\tret2 = ext4_convert_unwritten_extents(NULL,\n+\t\t\tret = ext4_issue_zeroout(inode, map.m_lblk, map.m_pblk,\n+\t\t\t\t\t\t map.m_len);\n+\t\t\tif (likely(!ret))\n+\t\t\t\tret = ext4_convert_unwritten_extents(NULL,\n \t\t\t\t\tinode, (loff_t)map.m_lblk << blkbits,\n \t\t\t\t\t(loff_t)map.m_len << blkbits);\n-\t\t\tif (ret2)\n+\t\t\tif (ret)\n \t\t\t\tbreak;\n \t\t}\n \n-\t\tmap.m_lblk += ret;\n-\t\tmap.m_len = len_lblk = len_lblk - ret;\n+\t\tmap.m_lblk += map.m_len;\n+\t\tmap.m_len = len_lblk = len_lblk - map.m_len;\n+\t\tepos = EXT4_LBLK_TO_B(inode, map.m_lblk);\n \t}\n+\n \tif (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))\n \t\tgoto retry;\n \n-\treturn ret > 0 ? ret2 : ret;\n+\tif (!epos || !new_size)\n+\t\treturn ret;\n+\n+\t/*\n+\t * Allocate blocks, update the file size to match the size of the\n+\t * already successfully allocated blocks.\n+\t */\n+\tif (epos > new_size)\n+\t\tepos = new_size;\n+\n+\thandle = ext4_journal_start(inode, EXT4_HT_MISC, 1);\n+\tif (IS_ERR(handle))\n+\t\treturn ret ? ret : PTR_ERR(handle);\n+\n+\text4_update_inode_size(inode, epos);\n+\tret2 = ext4_mark_inode_dirty(handle, inode);\n+\text4_update_inode_fsync_trans(handle, inode, 1);\n+\tret3 = ext4_journal_stop(handle);\n+\tret2 = ret3 ? ret3 : ret2;\n+\n+\tif (epos > old_size)\n+\t\tpagecache_isize_extended(inode, old_size, epos);\n+\n+\treturn ret ? ret : ret2;\n }\n \n static int ext4_collapse_range(struct file *file, loff_t offset, loff_t len);\n", "prefixes": [ "v4", "12/13" ] }