From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796231360; b=tx/X68VnPN15tHrwEX642MfpseVCOO+L0j6/fXOOMqXPQPewI5oeQMiBA3gyXjKDso4R VZ2F7bxkW8Dwn0pK+i6w9m0NA9d1gVl528VaXn+j3nTUrgwk02hbOUNYMJn+h4wVbBdAR o8mG5fiua1pp5qmlvqbDYnb8NXbUOZVGiVD2mMreh/H/qdHVYwYXTPtT/lJxeDJADQM/G vIEaY1rraKu/XO6STPbfzCp/fCVjdho1dBw5P7uG8hZBM/XU7Ry2Adnx3bjzh5RdEWx3h pFM3mmNtmsi6OxyUgw/HywU3K74MqbpjNL4xh3nvHqCXK9bhBbWSZyDOoa2VBSXF8lA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796231360; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=hIiesrouAfHeAhAMiSc3W1qSyUV78OBD6GFX6fc/cyw=; b=CHbtChML+kF5+CKyvZHZ2snEWZ8utJyt3EK65lYmhSbZlffoRGyTnxZ1/vdI0/8I86Tp bMrkq6jaDKJlLDOHtetjV4TX19MyX2TJkFLIzAHY+kVAitv655X8HL7oimcN6amCtNY5Z p5EVL97QO0RpI+dTyKhYwBoD3FFokmfUI52Gw0oSP1bvGvTad0FoyCKA9Xwj9my/VChLY K1o1D8EsjJ/cjo8Gu0NGUMpxBRbWlKyKrenx7k3YgMONGu2Pg7dIBC8TLjuGC8hQLorac 3X2awq4Sz0ursnp47wzjc0gvXCALqFCMp6nNEtlOoFkSh8BBCVa8P7EZNdoS9kmak6w== 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="l/2HCINa"; 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 F1620606A322; Wed, 2 Dec 2026 17:09: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=l/2HCINa Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43EC11F00899; Wed, 2 Dec 2026 17:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796231359; bh=hIiesrouAfHeAhAMiSc3W1qSyUV78OBD6GFX6fc/cyw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=l/2HCINaqBCPom7NjTa2KVNjc38cIpALRpB1/e/mVYmb74PvOmwr9CiPmrUkL59ym VWiRNP2Ysd/PJ9MHkftvLnLcPhEL9M2aNkEVwRU40L7t3OIBPFYaJnl3XlPvEgjuAk WnpwwWfC7nDjsY68pFWjrfX/PYnJbldzx3qpFPmT/EQaG6kOzUqX7m2ECYkEYdsOkw oS9EyqctmCRB+nF5uFV6aivqBDbjCzykVTKXCcNmh5M3gqKzeNF2HLRlhkdH6hXbo/ flx236Ik/pWRjNpWCSWPcZC3bteBZESpXChxT9apEfSnP1Yce+ByWxBnL2qdTTwNBX a6kpR71razuPw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v20 15/23] xfs: add XFS_BMAPI_UNWRITTEN to unmap unwritten extents in __xfs_bunmapi() Reply-To: sashiko-reviews@lists.linux.dev To: "Andrey Albershteyn" , linux-ext4 , "Eric Biggers" , "Christoph Hellwig" , "Carlos Maiolino" , fsverity Cc: "Christian Brauner" , david@fromorbit.com, "Darrick J. Wong" , dsterba@suse.cz, tytso@mit.edu In-Reply-To: <20261202165653.767961-16-aalbersh@kernel.org> References: <20261202165653.767961-1-aalbersh@kernel.org> <20261202165653.767961-16-aalbersh@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 17:09: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] xfs: skipped written extents count toward nexts limit in __xfs_bunmapi() -- commit d810ef6f3efad46182e39525768f25badd06f758 Author: Andrey Albershteyn xfs: add XFS_BMAPI_UNWRITTEN to unmap unwritten extents in __xfs_bunmapi() This commit introduces the XFS_BMAPI_UNWRITTEN flag for __xfs_bunmapi() so callers can unmap unwritten extents while leaving written extents intact. > diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c > index f744113129011..667b693aacb81 100644 > --- a/fs/xfs/libxfs/xfs_bmap.c > +++ b/fs/xfs/libxfs/xfs_bmap.c [ ... ] > @@ -5281,6 +5297,10 @@ __xfs_bunmapi( > if (del.br_startoff + del.br_blockcount > end + 1) > del.br_blockcount =3D end + 1 - del.br_startoff; > =20 > + if ((flags & XFS_BMAPI_UNWRITTEN) && > + del.br_state !=3D XFS_EXT_UNWRITTEN) > + goto skip; > + > if (!isrt || (flags & XFS_BMAPI_REMAP)) > goto delete; > =20 > @@ -5415,7 +5435,7 @@ __xfs_bunmapi( > if (error) > goto error0; > } > - > +skip: > end =3D del.br_startoff - 1; > nodelete: > /* [Severity: Medium] Should skipped written extents count against nexts? Jumping to skip falls through into nodelete and increments extno even though the extent was not modified: fs/xfs/libxfs/xfs_bmap.c:__xfs_bunmapi() { ... skip: end =3D del.br_startoff - 1; nodelete: /* * If not done go on to the next (previous) record. */ if (end !=3D (xfs_fileoff_t)-1 && end >=3D start) { if (!xfs_iext_get_extent(ifp, &icur, &got) || (got.br_startoff > end && !xfs_iext_prev_extent(ifp, &icur, &got))) { done =3D true; break; } extno++; } } Because xfs_bunmapi_range() calls __xfs_bunmapi() in a loop with nexts set to XFS_ITRUNC_MAX_EXTENTS (2), walking backward across post-EOF written fs-verity extents exits and restarts __xfs_bunmapi() every two skipped extents, re-allocating the bmbt cursor, re-searching the extent tree, and running xfs_defer_finish() without having unmapped anything. Also, any direct caller passing a bounded non-zero nexts with XFS_BMAPI_UNWRITTEN can return early without unmapping unwritten extents if at least nexts written extents appear first from the end of the range. Other paths in __xfs_bunmapi() that skip an untouched extent advance icur to the previous extent and continue without incrementing extno. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202165653.7679= 61-1-aalbersh@kernel.org?part=3D15