From nobody Tue Feb 10 01:36:07 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 CD8B3258CD9; Sat, 25 Oct 2025 03:30:05 +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=1761363007; cv=none; b=puLYGxxPsGC9L0y7RfspoIpBuzubuZGEziLtXBQVBHzW2BBVBv1HXqxe77tGrA0z80LKTxE+KnfxnE9uZURS6mhjtI86JTTs94aTOeN42vgPtuMlqhmDyyLmGALzFoz7TBtf7jH2pxujhScvMnkTBw6l4SslIEcWnqSNTWTLKD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761363007; c=relaxed/simple; bh=gD6jk6oN0DA/nptDxnEOjVbmdotmN01yMgX7ip2fJd0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QuhFC3n1tvm16Y6724cgIaiKNKyYwAkzr9QMKaQSvdEi6pYpSJYXLz7yP7E/OwFGk0FL95xTzE2dPufxh+WgZl8DWvJkqbrHdqA6ME15Acop9bKOU9926xYdDX73bk9vt5He7LISV1IlXx9IN1d/5OlkH+IM1plr8/CrYmnZ9xI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4ctlcK1NXzzYQtmT; Sat, 25 Oct 2025 11:29:05 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.75]) by mail.maildlp.com (Postfix) with ESMTP id CF7521A17EA; Sat, 25 Oct 2025 11:30:03 +0800 (CST) Received: from huaweicloud.com (unknown [10.50.87.129]) by APP2 (Coremail) with SMTP id Syh0CgBHnEQ6RPxox1YbBg--.45388S8; Sat, 25 Oct 2025 11:30:03 +0800 (CST) From: libaokun@huaweicloud.com To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, linux-kernel@vger.kernel.org, kernel@pankajraghav.com, mcgrof@kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, yi.zhang@huawei.com, yangerkun@huawei.com, chengzhihao1@huawei.com, libaokun1@huawei.com, libaokun@huaweicloud.com Subject: [PATCH 04/25] ext4: make ext4_punch_hole() support large block size Date: Sat, 25 Oct 2025 11:22:00 +0800 Message-Id: <20251025032221.2905818-5-libaokun@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20251025032221.2905818-1-libaokun@huaweicloud.com> References: <20251025032221.2905818-1-libaokun@huaweicloud.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: Syh0CgBHnEQ6RPxox1YbBg--.45388S8 X-Coremail-Antispam: 1UD129KBjvdXoW7XrWDZr1kXFy8AF1UGw17Wrg_yoWDCrXEya 48ur4xuw4rJr1v9rZYyr1YqFsFk348Crn8u3y3Gry5X3W0van3J3WDWF4S9a1UWF48WrZx Aw1DXFWxtF1xWjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbm8FF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAVCq3wA2048vs2 IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28E F7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr 1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r1Y6r17McIj6I8E87Iv67AKxVW8Jr0_Cr1UMcvjeVCFs4IE7xkEbVWUJVW8 JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2Y2 ka0xkIwI1lw4CEc2x0rVAKj4xxMxkF7I0En4kS14v26r1q6r43MxAIw28IcxkI7VAKI48J MxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwV AFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv2 0xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1lIxAIcVCF04k26c xKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAF wI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUdsqAUUUUU= X-CM-SenderInfo: 5olet0hnxqqx5xdzvxpfor3voofrz/1tbiAgAMBWj7Ua9I6gAAsE Content-Type: text/plain; charset="utf-8" From: Baokun Li Since the block size may be greater than the page size, when a hole extends beyond i_size, we need to align the hole's end upwards to the larger of PAGE_SIZE and blocksize. This is to prevent the issues seen in commit 2be4751b21ae ("ext4: fix 2nd xfstests 127 punch hole failure") from reappearing after BS > PS is supported. Signed-off-by: Baokun Li Reviewed-by: Zhang Yi --- fs/ext4/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 4c04af7e51c9..a63513a3db53 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4401,7 +4401,8 @@ int ext4_punch_hole(struct file *file, loff_t offset,= loff_t length) * the page that contains i_size. */ if (end > inode->i_size) - end =3D round_up(inode->i_size, PAGE_SIZE); + end =3D round_up(inode->i_size, + umax(PAGE_SIZE, sb->s_blocksize)); if (end > max_end) end =3D max_end; length =3D end - offset; --=20 2.46.1