From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796307354; b=OMtz+xKdyK+ZJMFYkAYFLpoeWKwpsArV+TNREMB1xMzIHZtJ2R8DyEyJjoz7PKWXkOxi CgYEmsa8YhwsR1sf22ymA2lEKVRciyBj9H5Fp6QPAloJLenfcqX4CwuTy3NvCh4Zw5v6W D2ZQgTaugSKNjPCBKUKtYFFIAQGNfS7/ifEwGzx3RVapwIjRlzFegz7nJN3vmTlNVw3E/ EBw7tlHxL1ALr3e5WbC9EplCt+Zz3YAAYtL2CIf85IVoB2n3voUAfrJWS0YgrxLZC769a Oj7YALk5NcT7ZiMmzNx/kGuZcS/p1muah0Jk6siFutqXvtrT/jhX5he5dXspLdMILSQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796307354; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=B4Wr3wwNXIL/WH7g0iHACoO8nFCuliw9ScrCdHw72hk=; b=F70BT/ouf22qNC2n5MAoySGFXlm6BVDWlgF7mLhDcm0os1lvosyIOjfVIG1VgacVLfBp uU0u2k8ROMvk6kwBVlTXZqBuzNrHwaBpv408KAOfvwhNIbBDZXSlhzyzXqPq2NO44mdBT +W9qm1bNbp9r73Gf1xvZ5LuV8IF+O+rQmqDEQ29BZo+4NZ6p1a+N3y5rBcoyBBetQACBC 7blSI81ci6OjW2Ytaxq3d3NFmgs80Iw1ropC9gdD/HTlncraiMJ+0K2sACl847dW6VD5N RRwJX7dRu5mEL/HCRECO5UXMXKJwwQv0D9hOpTT1bkq1xb4MfQlraB5yT6p8CRf+bcQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="q/29Bn7n"; arc=none smtp.remote-ip=209.85.216.50 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08277606A32F for ; Thu, 3 Dec 2026 14:15:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 08277606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=q/29Bn7n Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-3b43d30822fso7832829a91.3 for ; Thu, 03 Dec 2026 06:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796307353; x=1796912153; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=B4Wr3wwNXIL/WH7g0iHACoO8nFCuliw9ScrCdHw72hk=; b=q/29Bn7n5Fut1+3SZ3dSwGJdMoQTsVwGSxaKHt0ehl9wMUxlsaJKZU01mIX3Ii8boD Bf4IORi/wuGdXl/o4sSVyPcb1F5MjdxRuCOY69xkHT+rL5IZ69inPKD+fKtZVl0u1ZlQ cLfogmdHalpuapDYVKsv1DxQ81ZWnQcXUG6A0Wgk5Hrc5np+VY+hJAQl/215fcNyKTtF BxTmq8x3osu7juHZ5vulM4Yqz9Hc8hSnpfdgaXmcnCz4VWavFi7fKJZWL0t/IE8e4pr9 jLw7uePE/05RbJWVDUdMKDAtysMXOMFHIMneiR2g5fcoK0ygUEPikb3SnZFamfIGn1qy lovg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796307353; x=1796912153; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=B4Wr3wwNXIL/WH7g0iHACoO8nFCuliw9ScrCdHw72hk=; b=M3CW4eJxsqGTcsMAeBAh7s467kbtKc2s2Pg3Lvjwyzw5B4XD35LPSqXsuczQXUEDVU s7dhHFrrxzaDeafLHNc88FGBDD6rqa7UXe8C4yKtBtGdGD4LQGn4OUJUnWAkO8GY2Jlw Hx1KicqhbHXCULGtf+AjMxMdPG6/fyZxiKrKMpdnU/UsRjqI2gvCpL+/EUOTPmTWjtjD 8kNTVuKoeDvVLZcGvtDweKLu7n+z6H8HXUADTCSbh4idWZmtlqeTZTfMKd4ewhZy1yhl botP/9ywWoAn+JyG7pyt7EmUXqrguOsiXQyogwWFA1ZJjwwbld2CSGRUf7YQazr7ik51 0L+w== X-Forwarded-Encrypted: i=1; AL+hErHtquR5NOO4s6USSC/kT8+qr68O3iZMFkY8MzNr2Crkl6aUK8KmiQo4GWRkVupzWqJNW5/O9PgXfRbdtiw=@vger.kernel.org X-Gm-Message-State: APuU4Z8Dq6j3DxrOgB5VPyDlShmQCoS9inGb7P6Fxa9zT3JNJtU+NaA2 BCfUPihBMCqCK05O8yjy7LLJPWb/f/yzA36Yx4/jWeAtVFkzS44Pa9et X-Gm-Gg: AZFdTZcCJC2JvvYSnYlz4msabhO8gHopsc6UcwK/YB7fND0+V1KH7O5A4WI/1CmOEw/ zBnD2D9SMtoTLIiLWP3++cd07cy1/Raydj4Jf31aC8xlIlqsmORXWeVsKuL7y2tHX0KsFoE0+cg l+ejP/7yw78iA05bwMgjDDEC/rB6XlMXk1f0Wf1at4lCgE48clVuAKLmFQLSaIRakLfYXTnNzkJ ScR6KB5UlHo5tTlNCVXqWljSaqnRZuAQgmH/X2MLRwab6WmShhd8qhx1pVPCgOmoK4Aay3W+/ys /YTxrWliUqBi0uC02xTIfb5KhVBlxA0P1lJN5sYUCkG5BvWMBwV5gxvUxUtVIY+QiTORcDZGqcn nvhOyK5t2LFFsa4LZITN3nMqaet0vLLyEgRn8ZAU7/fR1kCsLZpLSW3ai0xPdzgGz+AdNSJondz 87tvH3frReyt7De7+13C0EjKvtvCgjnhhjGQwk9LZgQ/ZB/quMs3k61QabrFcrTDwOjdZRj/8DD XKaZcr/g4tQz0wUKBwJem4vkT+3gLvk6vAD0m2sf92AZHip0lDUpJt0+6bbVOp7uzqZaYWscykV BIKX+7+sIxhTuBLicpFr+tvtogqI+P6uUJ4QUMA= X-Received: by 2002:a17:90b:4a48:b0:3ab:2d17:51c5 with SMTP id 98e67ed59e1d1-3b41c7b60b5mr41225305a91.6.1796307353123; Thu, 03 Dec 2026 06:15:53 -0800 (PST) Received: from localhost.localdomain ([64.118.140.61]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cde6d03adafsm24544845a12.23.2026.12.03.06.15.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 03 Dec 2026 06:15:52 -0800 (PST) From: Ding Feng To: tytso@mit.edu, adilger.kernel@dilger.ca Cc: jack@suse.cz, libaokun@linux.alibaba.com, ojaswin@linux.ibm.com, ritesh.list@gmail.com, yi.zhang@huawei.com, hughd@google.com, david@fromorbit.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/2] ext4: fix the fast commit range of a punched hole Date: Thu, 3 Dec 2026 22:15:35 +0800 Message-ID: <20261203141536.52700-2-dingf3ng@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261203141536.52700-1-dingf3ng@gmail.com> References: <20261203141536.52700-1-dingf3ng@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ext4_fc_track_range() takes an inclusive end block: __track_range() records end - start + 1 blocks. ext4_punch_hole() passes end_lblk, the first block after the hole, so fast commit tracks one block more than the punch removed, and it is called even when the hole covers no whole block. The extra block also wraps the length: with huge_file, s_maxbytes is 0xffffffff blocks, so a hole from block 0 to s_maxbytes records a length of 0, which ext4_fc_snapshot_inode_data() reads as no change to the file's blocks. Today the hole stops at the block that holds i_size, so only a file that large gets there; the next patch lets the hole run to s_maxbytes on any file. Track [start_lblk, end_lblk - 1], and only when blocks were removed. Fixes: aa75f4d3daae ("ext4: main fast-commit commit path") Signed-off-by: Ding Feng --- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 07a62d856..866c1d92d 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5450,8 +5450,8 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length) ext4_es_insert_extent(inode, start_lblk, hole_len, ~0, EXTENT_STATUS_HOLE, 0); up_write(&EXT4_I(inode)->i_data_sem); + ext4_fc_track_range(handle, inode, start_lblk, end_lblk - 1); } - ext4_fc_track_range(handle, inode, start_lblk, end_lblk); ret = ext4_mark_inode_dirty(handle, inode); if (unlikely(ret)) -- 2.39.5