From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E9BFC61CE8 for ; Mon, 9 Jun 2025 16:07:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB2516B0095; Mon, 9 Jun 2025 12:07:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B63B96B0096; Mon, 9 Jun 2025 12:07:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7A2A6B0098; Mon, 9 Jun 2025 12:07:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 870DF6B0095 for ; Mon, 9 Jun 2025 12:07:52 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2CFC05BB2D for ; Mon, 9 Jun 2025 16:07:52 +0000 (UTC) X-FDA: 83536343184.09.F875D60 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf07.hostedemail.com (Postfix) with ESMTP id 8207C40010 for ; Mon, 9 Jun 2025 16:07:50 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NOfCOSlu; spf=pass (imf07.hostedemail.com: domain of djwong@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=djwong@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749485270; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=00QEJoTXxXZSnRgtBJmEqc1Z9Aas6yAWzBLNAzc/l1M=; b=uhilgER1UFRL/xgB09HUDXg0rNofHD+cyjXdmWdLL3s/jDG8WSYznmImJlisQuKIRkdp7G ywQgruYgLIiIadvm6dfzVJq7pm/LKHcNE8L32kwgX9lioOd09uODaz5VOcH6mbcLTp7rZT ea4VsXUgDkeh1xkpIuyYfbKgB3Hfuso= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NOfCOSlu; spf=pass (imf07.hostedemail.com: domain of djwong@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=djwong@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749485270; a=rsa-sha256; cv=none; b=HXngt99z+o5LAejAR0JTyHoWHjUmzT0bJRpjTxVKTq7fEjGwW0wpOMU+xUaTKZnUK2kCK+ TsDGNnWFY4w3Fwha1Cb/Ynd9XZ7eI1FptMec11rXshGbC/Xda5gbET1aOe0gRLd5VNhxNC z1Z2g4gcfRBRBzPaEHjmLkcGxKCLFcg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 17A8C49B01; Mon, 9 Jun 2025 16:07:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2DA9C4CEEF; Mon, 9 Jun 2025 16:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749485269; bh=ilnLvA0T6+iOwyYESqgjEj/JxpmDoP0F1PvGEw+kUQo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NOfCOSluUYlPvqxkecU8Q1/F2Cj+xZlcUaW5Ggv5lzcaDKQe00lUhH03L9cjBXluV uZGlFAbgJtFk3D7fILnw8dxOjmsxs9OiEg8urub114GafROib4vOfeD398x9m5+ZNi y3k62uBpUY4WJUdliJGjvWGViOqkN1UPW+80hrppOagUcL9R5U0VwFG7oa/XumVAcr QHCXl8+WbWMspVa/qX7bUb061R2KdRNZdYcPCRun3bthHfRBq19jmO9XbNV8IOE5p9 oGuEngdNhIHBVpogacVHYH3mtKjPfbE5H9Ov/zvBpp0YoHlihXodIhaZhpYp9sr9vN hQOCf/n6nuMLw== Date: Mon, 9 Jun 2025 09:07:48 -0700 From: "Darrick J. Wong" To: Brian Foster Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 4/7] xfs: always trim mapping to requested range for zero range Message-ID: <20250609160748.GD6156@frogsfrogsfrogs> References: <20250605173357.579720-1-bfoster@redhat.com> <20250605173357.579720-5-bfoster@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250605173357.579720-5-bfoster@redhat.com> X-Rspam-User: X-Stat-Signature: 14zacu8gnk1ucusis4ti6faxqnksgdrf X-Rspamd-Queue-Id: 8207C40010 X-Rspamd-Server: rspam11 X-HE-Tag: 1749485270-971349 X-HE-Meta: U2FsdGVkX1/jlWK3SvRTqf0ZwkAvXKH/vlf8bd0JLB2N56FiI5liVPBvdIlr5NGnuVp3sPl6RTnUmLTMiMHk684Ph9L6Pdop5QSsRorcWsL6WkZS64sxAKCW8Snfoa+6aQjuzrC6Jj9Fs9QFgxm3BRlT6GHkBd8jpjjw4S9ZrVEitKzV11SZdxjMY8Jm0n5HNlzLEPOmtld5SOzWUp2iSwM/sLOLZaQuysI5sVSCRO8X7xpvn5ueCreDrsFhkBi9PA9Fpycg9hSSFj1mRKHToGrM/GoSVomz9K/brCvwRyH9SyZDCBOfXK8CjSAXeFhpRnuHDkJuI0fddHaSEnRICyFYbvsmQkLkWFiw5BS4YkzugMR9cojYsDPbD2M8rA514D52gshxdIOUoZBnQcQppczQbWsq0a7QvzijtWCGoDFgdajKkYPZX/gnbPaS7GN50BXCKLPiFudmX6RpzpFYgTzB6wh22E4YEf7jxNvpaMx7/2PoYKpL0uxtqlGapQ1t9+WxbPRPxpmDnlHZrW/OUtcKxXokT+wi0mCf6yiWjCsyuLaO355lno/JlvHJH4wOqTTcdXYejam83ycuoBeQk54mAcOwNTQ8GHIYAAST1E5p3plaF167GoT2KuQYCQY2LqryYYBcDe8K0JChqVDyi/Ax2qn89XirIH59WIMQn2WV0ZFxPSq2Y0qoqbacE1x4tiC2q+aBcBC5+NUcSJ60Cg1qIhdmQ1nV5sL3sQ6bgLuK2DpLb/69X1liPAf9GxjgWGEz6JP5DUSuLIXyRvhZt3sBadkxrH0gugG+z+Azo7lqTxmJGB/se7isJN3WprITYmN/FJfjkFwG4typOQNvLE3VnJsrJZ5HaW7lUWGE4MHLM9ehgaj7TxavdhK/dHIFYumyYOwgR8TtKAzw6fAn2OWzn5IfzlwcOeJdQs8tfjYtDiM00lzvngRrxinQPqoilpayCwE5iQ4U45Ad38M Bzjh+XEa eZZIQGPTtSjGlfGYUwDfq5UsItyrTU5IpDg1Si+YPZTnUQza97Ieyr4d/HH4XusRyyafgn4MEyPcVyRtZ7McDIMinCn73yGBkVJMZePR4T0fFNIBOgRAEErefjPwWWz59Z5yM6TUoL12DxyzJROnf0U/T6ou9+TYTLUyHiAoLOmEBGw36FIZrtFeDix4RzJXDJls1x1E1RxZutVScwAqKxglujL83ywVCA7stvB/rjpKRmXgtqj2i0g0eKp1WwgDl0uO9iUknf8iVnq282Uclj/zCimx5I+VZMl2jlQHV5naC03g= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Jun 05, 2025 at 01:33:54PM -0400, Brian Foster wrote: > Refactor and tweak the IOMAP_ZERO logic in preparation to support > filling the folio batch for unwritten mappings. Drop the superfluous > imap offset check since the hole case has already been filtered out. > Split the the delalloc case handling into a sub-branch, and always > trim the imap to the requested offset/count so it can be more easily > used to bound the range to lookup in pagecache. > > Signed-off-by: Brian Foster > Reviewed-by: Christoph Hellwig Yeah, makes sense to me. Reviewed-by: "Darrick J. Wong" --D > --- > fs/xfs/xfs_iomap.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) > > diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c > index ff05e6b1b0bb..b5cf5bc6308d 100644 > --- a/fs/xfs/xfs_iomap.c > +++ b/fs/xfs/xfs_iomap.c > @@ -1756,21 +1756,20 @@ xfs_buffered_write_iomap_begin( > } > > /* > - * For zeroing, trim a delalloc extent that extends beyond the EOF > - * block. If it starts beyond the EOF block, convert it to an > + * For zeroing, trim extents that extend beyond the EOF block. If a > + * delalloc extent starts beyond the EOF block, convert it to an > * unwritten extent. > */ > - if ((flags & IOMAP_ZERO) && imap.br_startoff <= offset_fsb && > - isnullstartblock(imap.br_startblock)) { > + if (flags & IOMAP_ZERO) { > xfs_fileoff_t eof_fsb = XFS_B_TO_FSB(mp, XFS_ISIZE(ip)); > > - if (offset_fsb >= eof_fsb) > + if (isnullstartblock(imap.br_startblock) && > + offset_fsb >= eof_fsb) > goto convert_delay; > - if (end_fsb > eof_fsb) { > + if (offset_fsb < eof_fsb && end_fsb > eof_fsb) > end_fsb = eof_fsb; > - xfs_trim_extent(&imap, offset_fsb, > - end_fsb - offset_fsb); > - } > + > + xfs_trim_extent(&imap, offset_fsb, end_fsb - offset_fsb); > } > > /* > -- > 2.49.0 > >