From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796307354; b=OEt1P7yz5E/44rKWrTwa3IzYIfogmxOBDAK86Pji0IqoikhCTKv42jnR0/gaJlT9uzMc dwIrKCNyc2SPfshsomG5xHLQNz9qzNp61icaPQqDRbgFWWzfSuZHf9CIQseZKMIrk+ZWp 6vGnBwQrElWlIzzp8zhk7keSG8B2raJjpuawoH+2CPpOl/YHw2JJHuJ4iPXT0i0fHQk8Z rDin1OkZTxtgLs6RZyzgEGykwg1UJ+USOnDZlBC+mcnEeJDa6YF341mYK21wsE9ihNc0F XFQA5yl6MPnrIpzac2aci347RG5pKkQHCCceRBRn63CsH71QtIZBIWFCnScQMXvvOlg== 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=0tCbx0QEk+sij0rX/9FMgCRcsTdC1x6XX9Vv3mahj6Ppvuk6P2ZbTZOclm+W8VCKyuXW OQ6YRPRzpfCWV0BQy7RExKkOcF4Xlnrk5BUfVoqL5OILYhCk0MhEe02bXEmFVQ3InNrLx Ul8W2ywAVHQmoJPbeMeQ/l8X6pxbG5RBwQ3FxkVpw5qpeK0CExTDYDBapbWBRzhG/wwdO +ZgqG64a6uikcb8/cEPhueq2ejKyg4hyLKvuZrkVWvaHmIiyFh0+nB5n42wsdI2BM3DKd jcvKi70IiQd5OWmEe0U1n1wH4Yw6187irMT5VPA9087z1Wb8SAQBf76e3fceSUUgzFA== 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.51 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 05D33606A32D for ; Thu, 3 Dec 2026 14:15:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 05D33606A32D 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-f51.google.com with SMTP id 98e67ed59e1d1-3b567ae3c66so2745628a91.0 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=hb3G85FXZBgGRlr7T4pNCz+cXsdOx/h8QNi7W7guXrJx71fYTXnxZCcV2fpwrIeQIl vlqDx0TzXahNWgj2R7rJmyw9YL0o8WY7n+59gB8jJj1uhNgu6mA36NyCz4uuhCpJZLDc w0jiT5R5BAMbpG9k4vlpXVxOcvhr4vNePzR3sZbydv1lq3WnFOfwyN5I792MUeBcbDEA fmQ658AakHV+bBf63r1H9OdzExdEYiaGRXoOoqSNQJZXU9lSfuEm8tqJytbnKagufIgT sbjjlxDPNWYcnIZoSfVcda27qMoU5ZuYGUMx59y1wPxbnjOhKBu9OKwPOwdHq1fdezw0 mdhw== X-Forwarded-Encrypted: i=1; AL+hErEl2pYQb5w0+4yDbQetjviLGrMo6aLC3ayuIwXqvgEJAGhBJ+wmNU401kmCtVMaJgFjSb5J0E0+6cw1@vger.kernel.org X-Gm-Message-State: APuU4Z+Xkue8GULB6/zFS5QVwuUD9yr1TVCa7JU/N1IO0oGIeO2cGe5z ZvAeJOaI6qZHhab0B3rZqM1uWtW5MwwslMQJSiGZz5XWHQBKOz+Igbuh X-Gm-Gg: AZFdTZeLDM/v9VLap0eSiirbZiPko6VdVcPsaZTqpRAHEg8KsjyKR6V7x5iDwq4Nc3t I5kOSA3MO+rAPpdKcCKs9j2nQuzONUzNlCQ1ifaZAROaTbQZXupE+wO9mRGtXAmPQx8mPl1HSIE IthuxE1IHpWGiD4Mh2S75h7SnrRsa8CAYcsF/xwx5aQVCN8HLGf+qL1ISsXm6NJnn/vZ1sTtv0H 4cIwuldM+7YHMdkjpTe9UMMUg33exK1XL57OC5316j0vSS03/xArz6i/5DGM03s8wn+Mnvi2FqW J21w2cq1DjK8IIvwR8UBgTcxYs32fh1DdbLZB1kkairpPF1n8QH1OsUGFIPPuvCHIXL+0R4yldG t+Dgpwg7ekLcseA2GZODhyP68S8IuPJ5dK53zDMXr2RYaWsYqc977Ql5gijytEWxTPga+tsVwS1 GeWqg9zUrOtoGmy2TwXWmgEhhT4Pk2BERNqniHWdcwwVIGzOO6urp/dOaQpjJvGXchQw3k5vRB2 dzbiPiESmeFzulhaofEMnghEeotcMbhXRL7/awWbQ4sBCcy9zC2spUVAJVmuO5oHgFmTz5p1NZs KVScYBZQ6Gsb0EnR99RRiTRlBmriYwgX5HxOsME= 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-ext4@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