Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796081299; b=WRx30RwOAXqDE+kUEHyGKn+Wh1055q90OlBJ+ihGtjco7xfbINqCdyfqNPXIiT9PCeem faLFzx8WhKhipWq+FFNByyIyv8YxsrIx4jdco/Z+i7K0OCatx/TM741ZC1Ptnq/Hd7c/t gg+vhs4bw6Xibjiaz6934/8nEclg9TFVnJLd9sYEkP0GDe1phEjd2w0D+FtFXlAxelb5X AaSjfJG0LwBketLPfLTRHJi9CgPJgMHGjaduzlbDoepfvbTVTNJ057oiOjTrqk2+Xc7XE iqVY5p/397tg/nVsUBwvBU/ijiAYpkRQDynWDtSF3EwYlK1DrH7zzzH2zSsL9KBFR5Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796081299; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Uwj1ojv8QUYu362dmee5sRABkSDjN8fsS8gdXSZO1wc=; b=bol0Lr+dGYyzc3gkKSoK11O0RIFAKxss1BB7SMwf73rseLfXMCy7y22uUfikXexIczkg LoS+k2tgiS3Spc44DndKW/1ILTPTtueliXm8XuUQwYDO6LyvIiASPmDwb3TkMNLugVbwI HLrmIGV30m/WOKu82JDU0tCG1B6W8ieC5Z+J0mtdru2MPzsVk2x3BodyoAyIKEJzd/XtB hx8p8HuPoYbWVT/hIVBU4TQYG0pVbExxAS38ELDGIhk/xCWRAhEOlLiSTsepULLp70E9V 1o1oH2oS6WuSldJC94psLx42E4+6MtpYSOzrJy7PLn79dm0e6usl7NB8lCKDptY/omQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=S2pXlBhb; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DAE2606A327 for ; Mon, 30 Nov 2026 23:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=S2pXlBhb Received: by smtp.kernel.org (Postfix) with ESMTPSA id C80931F0089A; Mon, 30 Nov 2026 23:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796081298; bh=Uwj1ojv8QUYu362dmee5sRABkSDjN8fsS8gdXSZO1wc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=S2pXlBhbFnoQ2yN44iWYbHdTPfWfV68jNQCzRc6+lA04OANJElnKyIbg1mAOXLVUc 9jqI2ixfr5fb0XaC1jVF4PBMl+qbZKgC6AmgZNFd5DdeR0Lwa7dP3V/vtTnQRiNTPA DPEj5zgG2BfSOy+3DwOtdt/Ysj3VEyKbRd/QiGFCPnmy2jg1cRxVsahZTmLTblGxPP ItPx8EtLgdmuTiN5geRHELxiAoDzHE3o0UQqdIGHNNwhtYpD43X2NPPzxDXn8a8FAB w05V5VipSOcZcVFYQH0sEaE7yOEHJoMLUL+r3vO/IZuNrqmPmrl1gRTfKjyPRwsAku G16SiJImj1nGA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 2/2] ext4: track truncated block range in ext4_truncate() for fast commit Reply-To: sashiko-reviews@lists.linux.dev To: "Xing Ma" , linux-ext4@vger.kernel.org Cc: tytso@mit.edu In-Reply-To: <20261201070558.4017023-3-maxing.lan@bytedance.com> References: <20261201070558.4017023-1-maxing.lan@bytedance.com> <20261201070558.4017023-3-maxing.lan@bytedance.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 23:28:18 +0000 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] ext4: range mismatch between ext4_truncate_down() and ext4_ext_truncate() -- commit e0b0a96d89503d8b723098577fe6474607943c18 Author: Xing Ma ext4: track truncated block range in ext4_truncate() for fast commit This commit inserts an EXTENT_STATUS_HOLE entry in ext4_ext_truncate() and calls ext4_fc_track_range() in ext4_truncate() so that truncated ranges are tracked for fast commit. > diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c > index b65b0261ee5c3..a47b56e3cbe9c 100644 > --- a/fs/ext4/extents.c > +++ b/fs/ext4/extents.c > @@ -4608,6 +4608,11 @@ int ext4_ext_truncate(handle_t *handle, struct ino= de *inode) > memalloc_retry_wait(GFP_ATOMIC); > goto retry_remove_space; > } > + if (!err && inode->i_nlink && test_opt2(sb, JOURNAL_FAST_COMMIT) && > + last_block < EXT_MAX_BLOCKS) > + ext4_es_insert_extent(inode, last_block, > + EXT_MAX_BLOCKS - last_block, ~0, > + EXTENT_STATUS_HOLE, 0); > return err; > } > =20 > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index 07a62d8569d31..78823397d4245 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -5608,6 +5608,16 @@ int ext4_truncate(struct inode *inode) > if (err) > goto out_stop; > =20 > + if (!ext4_handle_is_aborted(handle)) { > + ext4_lblk_t last_block; > + > + last_block =3D (inode->i_size + inode->i_sb->s_blocksize - 1) > + >> inode->i_blkbits; > + if (last_block < EXT_MAX_BLOCKS) > + ext4_fc_track_range(handle, inode, last_block, > + EXT_MAX_BLOCKS - 1); > + } [Severity: Medium] When shrinking a file to a non-zero size, doesn't ext4_truncate_down() still leave i_fc_lblk_start set to last_block - 1 while ext4_ext_truncate() only inserts the EXTENT_STATUS_HOLE entry starting at last_block? In ext4_truncate_down(), start_lblk is computed before calling ext4_truncate(): fs/ext4/inode.c:ext4_truncate_down() { ... start_lblk =3D newsize > 0 ? (newsize - 1) >> inode->i_blkbits : 0; ext4_fc_track_range(handle, inode, start_lblk, EXT_MAX_BLOCKS - 1); ... } For any newsize > 0, start_lblk is last_block - 1 (for example, truncating = to a block-aligned 4K gives start_lblk =3D 0 and last_block =3D 1). When both handles run in the same transaction, __track_range() merges the two ranges with min(ei->i_fc_lblk_start, __arg->start), keeping i_fc_lblk_start at last_block - 1. If block last_block - 1 is not already cached in i_es_tree (such as on a block-aligned truncate where ext4_block_zero_eof() is skipped and its extent was not queried or was reclaimed), ext4_fc_snapshot_inode_data() starts scanning at last_block - 1, hits EXT4_FC_SNAP_ERR_ES_MISS, and falls back to a full journal commit. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201070558.4017= 023-1-maxing.lan@bytedance.com?part=3D2