From nobody Mon Feb 9 12:24:40 2026 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AA47274B59; Tue, 3 Feb 2026 06:30:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770100218; cv=none; b=rIE+ORotirKDXm5R7BR1XT7CvvRtbGWWnenv8f0y8zzMewjqg7zkiEvhIQMh2dIeF4ahX0PvDM2UUKpMaZ+hboBkLDazi08PLsXuIp6/owXCf9oOxRs9XuHcOYi6UZJRIwabUhjEN5WcKbIUEh6nkKCDkA+zWu51qYnu8DVhXkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770100218; c=relaxed/simple; bh=CMTE+Cf76Gzeg0G+tthiDJ1aQ5q8wvGQclGet9gJkbg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZCnXttZfzvoDzfghq1R/vk07Egfo0tTfidRwydhcY3LXH04/dj3RRyx5d0QSGYUeLHMVTRNqUjr1eMpM58hz796Dy83rPepky1nzWemm4BXNOhxSMa8iHrsdaMkGOzukahg0tiq3sYmTmOSZlp6I8XljL6s8s9c8YJVM+T5XK0w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.177]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4f4tqp6QR3zYQtvJ; Tue, 3 Feb 2026 14:29:26 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id D07B84058F; Tue, 3 Feb 2026 14:30:13 +0800 (CST) Received: from huaweicloud.com (unknown [10.50.85.155]) by APP4 (Coremail) with SMTP id gCh0CgAHaPjnlYFpiadbGA--.27803S6; Tue, 03 Feb 2026 14:30:13 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ojaswin@linux.ibm.com, ritesh.list@gmail.com, hch@infradead.org, djwong@kernel.org, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, yizhang089@gmail.com, libaokun1@huawei.com, yangerkun@huawei.com, yukuai@fnnas.com Subject: [PATCH -next v2 02/22] ext4: make ext4_block_truncate_page() return zeroed length Date: Tue, 3 Feb 2026 14:25:02 +0800 Message-ID: <20260203062523.3869120-3-yi.zhang@huawei.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260203062523.3869120-1-yi.zhang@huawei.com> References: <20260203062523.3869120-1-yi.zhang@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgAHaPjnlYFpiadbGA--.27803S6 X-Coremail-Antispam: 1UD129KBjvJXoW7WF18Cr1Dtw4kJF18KFyrCrg_yoW8AFWUp3 45GrW5Wr47u34q9an7uFs3Xr1a93WfGFW8Way3Gr98u34fXF1ftF90g3ZYvF4jg3yxXayj qF45tFW7uw17ArJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUHYb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUXw A2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7Iv64x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YV CY1x02628vn2kIc2xKxwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCF04k2 0xvEw4C26cxK6c8Ij28IcwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r 1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIxkGc2Ij 64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr 0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07UCiihUUUUU= Sender: yi.zhang@huaweicloud.com X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ Content-Type: text/plain; charset="utf-8" Modify ext4_block_truncate_page() to return the zeroed length. This is prepared for the move out of ordered data handling in __ext4_block_zero_page_range(), which is prepared for the conversion of block zero range to the iomap infrastructure. Signed-off-by: Zhang Yi --- fs/ext4/inode.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 759a2a031a9d..f856ea015263 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4163,6 +4163,7 @@ static int ext4_block_zero_page_range(handle_t *handl= e, * up to the end of the block which corresponds to `from'. * This required during truncate. We need to physically zero the tail end * of that block so it doesn't yield old data if the file is later grown. + * Return the zeroed length on success. */ static int ext4_block_truncate_page(handle_t *handle, struct address_space *mapping, loff_t from) @@ -4170,6 +4171,8 @@ static int ext4_block_truncate_page(handle_t *handle, unsigned length; unsigned blocksize; struct inode *inode =3D mapping->host; + bool did_zero =3D false; + int err; =20 /* If we are processing an encrypted inode during orphan list handling */ if (IS_ENCRYPTED(inode) && !fscrypt_has_encryption_key(inode)) @@ -4178,7 +4181,12 @@ static int ext4_block_truncate_page(handle_t *handle, blocksize =3D i_blocksize(inode); length =3D blocksize - (from & (blocksize - 1)); =20 - return ext4_block_zero_page_range(handle, mapping, from, length, NULL); + err =3D ext4_block_zero_page_range(handle, mapping, from, length, + &did_zero); + if (err) + return err; + + return did_zero ? length : 0; } =20 int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, --=20 2.52.0