{"id":2225654,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2225654/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260421113416.4040274-2-yangerkun@huawei.com/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.1/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},"msgid":"<20260421113416.4040274-2-yangerkun@huawei.com>","date":"2026-04-21T11:34:14","name":"[PATH,6.6,1/3] ext4: get rid of ppath in get_ext_path()","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"238950fa63ef5cc20c4a11a31ac90a8d457a229c","submitter":{"id":75707,"url":"http://patchwork.ozlabs.org/api/1.1/people/75707/?format=json","name":"Yang Erkun","email":"yangerkun@huawei.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260421113416.4040274-2-yangerkun@huawei.com/mbox/","series":[{"id":500784,"url":"http://patchwork.ozlabs.org/api/1.1/series/500784/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=500784","date":"2026-04-21T11:34:14","name":"fix potential ext4 null pointer","version":1,"mbox":"http://patchwork.ozlabs.org/series/500784/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2225654/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2225654/checks/","tags":{},"headers":{"Return-Path":"\n <SRS0=p66Q=CU=vger.kernel.org=linux-ext4+bounces-15952-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=150.107.74.76; helo=mail.ozlabs.org;\n envelope-from=srs0=p66q=cu=vger.kernel.org=linux-ext4+bounces-15952-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c15:e001:75::12fc:5321\"\n arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=fail (p=quarantine dis=none) header.from=huawei.com","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15952-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=45.249.212.51","smtp.subspace.kernel.org;\n dmarc=fail (p=quarantine dis=none) header.from=huawei.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=huaweicloud.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 4g0LFG4J7bz1yGt\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 21:47:30 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g0LFF5K52z4wCQ\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 21:47:29 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4g0LFF5FZvz4w1Y; Tue, 21 Apr 2026 21:47:29 +1000 (AEST)","from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::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 4g0LF83pH5z4wCQ\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 21 Apr 2026 21:47:24 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 13CDF300E4A9\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 21 Apr 2026 11:47:22 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id AA6273783DE;\n\tTue, 21 Apr 2026 11:47:21 +0000 (UTC)","from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com\n [45.249.212.51])\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 87ECC363097\n\tfor <linux-ext4@vger.kernel.org>; Tue, 21 Apr 2026 11:47:18 +0000 (UTC)","from mail.maildlp.com (unknown [172.19.163.198])\n\tby dggsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4g0LCl3MMkzYQv7t\n\tfor <linux-ext4@vger.kernel.org>; Tue, 21 Apr 2026 19:46:11 +0800 (CST)","from mail02.huawei.com (unknown [10.116.40.252])\n\tby mail.maildlp.com (Postfix) with ESMTP id A08DD40604\n\tfor <linux-ext4@vger.kernel.org>; Tue, 21 Apr 2026 19:47:07 +0800 (CST)","from huaweicloud.com (unknown [10.50.87.129])\n\tby APP3 (Coremail) with SMTP id _Ch0CgAHtL21Y+dp_aHLBA--.55420S5;\n\tTue, 21 Apr 2026 19:47:05 +0800 (CST)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1776772049; cv=pass;\n\tb=KTl7vKAhLEFXwpl9wDnWFdkq/6A/W5TKmq+hU39q7ZnZf2+SLELWIOtEq9K+BpXCNe6LpxG76yp8EypYcuZbYwtE0nzaoKM3FyU0Kl9lFdImSY9G5iqy2YHXVEE+k4KpEv6kBis+wWUKND124H/uB2meYGMvkfeMZZVgkQ+drMqO8JlRgAnK8vkE0bGTw48GNxz1h2mLIsU+OwvacNgCRnkmeYV7ss6RogHjzp4LXmfZa0b3U4sg0W/so0RdROwMCBAnAegh5r9UvHo0oT6O25DejsFSvdy55zPkdZxGcfqyWUoj0r/8ggjje2NoiRUz95RB3X0TQmJBuYZFbnsjYw==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776772041; cv=none;\n b=T3m06dj10O5KZ/YPcWxUHVW8h4cXmGUVvLVFsc19Xr/DmoC9y12EoTa5r+YAPvUJFZdpQEH/N0fW+Zefx8FDp9zTYo2xTae9Wl9ayYNtsIXeij9j32VZFbOgt2Axzxgd8BMkvgxx9s9jwXQp4X4V3Z5pq/6A2+MnzpUKJYlA5ic="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1776772049; c=relaxed/relaxed;\n\tbh=GZBGVEdt0ylpQHRsGQ/WDi/Txavi6tut1gYyHe1fPC0=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=czetthhMQliz9/FJvgl80HN3HaABOqYkZn91GdG9biLrJoUO/+7o9W4YcNrufV3FIn7p2zfbbrx5G2BbWaXT8EmncfzwtZtbUUXQwQ+WUJyFUylZ2r39QsvA7Jz2JMmAiet1h2n6SYZbu7Mz177Wo4uBXIImJ+ZUyyuFGl8HW83tHdJxx1Nh72SVdXDF7WnVhtWSDdE6CGzD8reYstcanTFM6k4oDlK0ocavWhKe6w/StSDsxCZFbSCNqLxrw6CcpMutrpFwzOUFso7zsR98FLJZ5Sz0n0n8ph2RPdfJpt5qAGWq0PTx46aF72PGHkI5vk9lHrYSTRH8Fd7nwT9xvA==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776772041; c=relaxed/simple;\n\tbh=D66/wMh0iVaRHLdp1t7CiazsAhJEfo45kH7FuW4jvlA=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=Rmq5tbqQqy4aZXiDdN0fSfB5HSssA9eA/JQ6QEvVCZuvLBeUn1YWk4/hSDrqLgZhEDa1tKYb5B6MICEwOB/GzODpK8tvryuhwzqrDxRUWsja/LZoa9u6AKe3oP/IcImhfFGBc0569GzMuWPr0E1qmhS898seXpRO1DnQ2QOZvJk="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=fail (p=quarantine dis=none) header.from=huawei.com;\n spf=pass (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15952-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=fail (p=quarantine dis=none) header.from=huawei.com;\n spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51"],"From":"Yang Erkun <yangerkun@huawei.com>","To":"stable@kernel.org,\n\tlinux-ext4@vger.kernel.org","Cc":"tytso@mit.edu,\n\tlibaokun@linux.alibaba.com,\n\tadilger.kernel@dilger.ca,\n\tojaswin@linux.ibm.com,\n\tritesh.list@gmail.com,\n\tjack@suse.cz,\n\tgregkh@linuxfoundation.org,\n\tsashal@kernel.org,\n\tyangerkun@huawei.com,\n\tyi.zhang@huawei.com,\n\tzhangxiaoxu5@huawei.com","Subject":"[PATH 6.6 1/3] ext4: get rid of ppath in get_ext_path()","Date":"Tue, 21 Apr 2026 19:34:14 +0800","Message-Id":"<20260421113416.4040274-2-yangerkun@huawei.com>","X-Mailer":"git-send-email 2.39.2","In-Reply-To":"<20260421113416.4040274-1-yangerkun@huawei.com>","References":"<20260421113416.4040274-1-yangerkun@huawei.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":"_Ch0CgAHtL21Y+dp_aHLBA--.55420S5","X-Coremail-Antispam":"1UD129KBjvJXoWxAw4kJrW7Kr48uw47tF18Zrb_yoWrWrWkpF\n\t4Syr1Ygr40qa12krZ7Ka1UZr1UKa1rG3y7WryfGw109FW7Xr1F9F1xt3WYvFyrKFW8WFya\n\tvF4Syr1UC34UKrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDU0xBIdaVrnRJUUUmvb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2\n\t6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGw\n\tA2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS\n\tw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV\n\tWxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_\n\tGcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx\n\t0E2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r4UJVWxJr1lOx8S6xCaFVCjc4AY\n\t6r1j6r4UM4x0Y48IcxkI7VAKI48JM4IIrI8v6xkF7I0E8cxan2IY04v7MxkF7I0En4kS14\n\tv26r1q6r43MxAIw28IcxkI7VAKI48JMxAIw28IcVAKzI0EY4vE52x082I5MxC20s026xCa\n\tFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_Jr\n\tWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j\n\t6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr\n\t0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUv\n\tcSsGvfC2KfnxnUUI43ZEXa7IU875r7UUUUU==","Sender":"yangerkun@huaweicloud.com","X-CM-SenderInfo":"51dqwvhunx0q5kxd4v5lfo033gof0z/","X-Spam-Status":"No, score=0.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDMARC_QUAR,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: Baokun Li <libaokun1@huawei.com>\n\n[ Upstream commit 6b854d552711aa33f59eda334e6d94a00d8825bb ]\n\nThe use of path and ppath is now very confusing, so to make the code more\nreadable, pass path between functions uniformly, and get rid of ppath.\n\nAfter getting rid of ppath in get_ext_path(), its caller may pass an error\npointer to ext4_free_ext_path(), so it needs to teach ext4_free_ext_path()\nand ext4_ext_drop_refs() to skip the error pointer. No functional changes.\n\nSigned-off-by: Baokun Li <libaokun1@huawei.com>\nReviewed-by: Jan Kara <jack@suse.cz>\nReviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>\nTested-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>\nLink: https://patch.msgid.link/20240822023545.1994557-13-libaokun@huaweicloud.com\nSigned-off-by: Theodore Ts'o <tytso@mit.edu>\n[we need IS_ERR_OR_NULL to prevent oops]\nReported-by: Hulk Robot <hulkrobot@huawei.com>\nSigned-off-by: Yang Erkun <yangerkun@huawei.com>\n---\n fs/ext4/extents.c     |  5 +++--\n fs/ext4/move_extent.c | 34 +++++++++++++++++-----------------\n 2 files changed, 20 insertions(+), 19 deletions(-)","diff":"diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c\nindex 7626cf2b07f1..300bf2289bc1 100644\n--- a/fs/ext4/extents.c\n+++ b/fs/ext4/extents.c\n@@ -114,7 +114,7 @@ static void ext4_ext_drop_refs(struct ext4_ext_path *path)\n {\n \tint depth, i;\n \n-\tif (!path)\n+\tif (IS_ERR_OR_NULL(path))\n \t\treturn;\n \tdepth = path->p_depth;\n \tfor (i = 0; i <= depth; i++, path++) {\n@@ -125,6 +125,8 @@ static void ext4_ext_drop_refs(struct ext4_ext_path *path)\n \n void ext4_free_ext_path(struct ext4_ext_path *path)\n {\n+\tif (IS_ERR_OR_NULL(path))\n+\t\treturn;\n \text4_ext_drop_refs(path);\n \tkfree(path);\n }\n@@ -4227,7 +4229,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,\n \tpath = ext4_find_extent(inode, map->m_lblk, NULL, 0);\n \tif (IS_ERR(path)) {\n \t\terr = PTR_ERR(path);\n-\t\tpath = NULL;\n \t\tgoto out;\n \t}\n \ndiff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c\nindex d5636a2a718a..96a84de32169 100644\n--- a/fs/ext4/move_extent.c\n+++ b/fs/ext4/move_extent.c\n@@ -17,27 +17,23 @@\n  * get_ext_path() - Find an extent path for designated logical block number.\n  * @inode:\tinode to be searched\n  * @lblock:\tlogical block number to find an extent path\n- * @ppath:\tpointer to an extent path pointer (for output)\n+ * @path:\tpointer to an extent path\n  *\n- * ext4_find_extent wrapper. Return 0 on success, or a negative error value\n- * on failure.\n+ * ext4_find_extent wrapper. Return an extent path pointer on success,\n+ * or an error pointer on failure.\n  */\n-static inline int\n+static inline struct ext4_ext_path *\n get_ext_path(struct inode *inode, ext4_lblk_t lblock,\n-\t\tstruct ext4_ext_path **ppath)\n+\t     struct ext4_ext_path *path)\n {\n-\tstruct ext4_ext_path *path = *ppath;\n-\n-\t*ppath = NULL;\n \tpath = ext4_find_extent(inode, lblock, path, EXT4_EX_NOCACHE);\n \tif (IS_ERR(path))\n-\t\treturn PTR_ERR(path);\n+\t\treturn path;\n \tif (path[ext_depth(inode)].p_ext == NULL) {\n \t\text4_free_ext_path(path);\n-\t\treturn -ENODATA;\n+\t\treturn ERR_PTR(-ENODATA);\n \t}\n-\t*ppath = path;\n-\treturn 0;\n+\treturn path;\n }\n \n /**\n@@ -95,9 +91,11 @@ mext_check_coverage(struct inode *inode, ext4_lblk_t from, ext4_lblk_t count,\n \tint ret = 0;\n \text4_lblk_t last = from + count;\n \twhile (from < last) {\n-\t\t*err = get_ext_path(inode, from, &path);\n-\t\tif (*err)\n-\t\t\tgoto out;\n+\t\tpath = get_ext_path(inode, from, path);\n+\t\tif (IS_ERR(path)) {\n+\t\t\t*err = PTR_ERR(path);\n+\t\t\treturn ret;\n+\t\t}\n \t\text = path[ext_depth(inode)].p_ext;\n \t\tif (unwritten != ext4_ext_is_unwritten(ext))\n \t\t\tgoto out;\n@@ -634,9 +632,11 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,\n \t\tint offset_in_page;\n \t\tint unwritten, cur_len;\n \n-\t\tret = get_ext_path(orig_inode, o_start, &path);\n-\t\tif (ret)\n+\t\tpath = get_ext_path(orig_inode, o_start, path);\n+\t\tif (IS_ERR(path)) {\n+\t\t\tret = PTR_ERR(path);\n \t\t\tgoto out;\n+\t\t}\n \t\tex = path[path->p_depth].p_ext;\n \t\tcur_blk = le32_to_cpu(ex->ee_block);\n \t\tcur_len = ext4_ext_get_actual_len(ex);\n","prefixes":["PATH","6.6","1/3"]}