From patchwork Mon Apr 14 05:35:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 14049762 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE55D1862 for ; Mon, 14 Apr 2025 05:36:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744609019; cv=none; b=l0P6zf8335v+HGnu/Ttr6VGmMHUbA/oYG/jl2/r6VbqSmB436jxhCene9o4PHi8yG23ryqdE/qwlTCtrkDmJc1wg6cyPfZ/4AaeqmFGnRG8BieE7r29mElNBzDmaUQ7C/+W5XGG2y+h4Xn4ng0Sy82fc+fnYVPY6PO716SdmigQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744609019; c=relaxed/simple; bh=E7MdulDnhnb8qQFbZKAS1xUO6NZ3hV92s+OtoSHR2rM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QQvcYFmRLA0+YHoYPhggG7UXmD8iyZDmHWWqUYZ5Qc7nm/hw+WeSMuokFyUJMQlzQGgHOgoVqF29WB9WQw+3bh+5qrPVwfawWpQw6zNet/5NhiKDuXdJc/N8BjtG14cyvs9JiVHqzWqldTLr/Ed3ztrj63jTwwOhJ9Pe2NLwWCk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=H8uss8f6; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="H8uss8f6" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=MivaGvbpCZ2di3mJkXqGqejX/yspcP2CysmcdHHBt9M=; b=H8uss8f6GQIkDMXWM4gbqsCewf A7FC2d5EOcCe9hs1JqAqoa10ssTV+H1PtSQjJ4l+vOucvvVImjWgydLlhz4U463ErRpetswrN+1lT bTf117lsNZ6StHge4Y2norkhOTvd2BzxShaUi+v7v+lB8Wj18YfNHB5IHA4WKjWEDaNhoQAWQTdf5 FU52rTht9VpOsB1VCom5ltnIjDtiD3sBvLGseYJLuivTIHFLw9YGWL/W3ZNM9WSe6jlJ2MIUIGZz1 pEbtx4JZ+Ig0Eo8E7yi7yc6UCk2tzIInj+/f39r5X4d3iO3MwOTYuA2kXK3YeNetCiOX/f7fIJ+XW sCqbDtDA==; Received: from 2a02-8389-2341-5b80-9d44-dd57-c276-829a.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:9d44:dd57:c276:829a] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1u4CV6-00000000iAs-3D57; Mon, 14 Apr 2025 05:36:57 +0000 From: Christoph Hellwig To: Andrey Albershteyn Cc: "Darrick J . Wong" , Hans Holmberg , linux-xfs@vger.kernel.org Subject: [PATCH 08/43] xfs: support XFS_BMAPI_REMAP in xfs_bmap_del_extent_delay Date: Mon, 14 Apr 2025 07:35:51 +0200 Message-ID: <20250414053629.360672-9-hch@lst.de> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250414053629.360672-1-hch@lst.de> References: <20250414053629.360672-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Source kernel commit: f42c652434de5e26e02798bf6a0c2a4a8627196b The zone allocator wants to be able to remove a delalloc mapping in the COW fork while keeping the block reservation. To support that pass the flags argument down to xfs_bmap_del_extent_delay and support the XFS_BMAPI_REMAP flag to keep the reservation. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" Signed-off-by: Christoph Hellwig --- libxfs/xfs_bmap.c | 10 +++++++--- libxfs/xfs_bmap.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 4dc66e77744f..c40cdf004ac9 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -4662,7 +4662,8 @@ xfs_bmap_del_extent_delay( int whichfork, struct xfs_iext_cursor *icur, struct xfs_bmbt_irec *got, - struct xfs_bmbt_irec *del) + struct xfs_bmbt_irec *del, + uint32_t bflags) /* bmapi flags */ { struct xfs_mount *mp = ip->i_mount; struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); @@ -4782,7 +4783,9 @@ xfs_bmap_del_extent_delay( da_diff = da_old - da_new; fdblocks = da_diff; - if (isrt) + if (bflags & XFS_BMAPI_REMAP) + ; + else if (isrt) xfs_add_frextents(mp, xfs_blen_to_rtbxlen(mp, del->br_blockcount)); else fdblocks += del->br_blockcount; @@ -5384,7 +5387,8 @@ __xfs_bunmapi( delete: if (wasdel) { - xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, &del); + xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, + &del, flags); } else { error = xfs_bmap_del_extent_real(ip, tp, &icur, cur, &del, &tmp_logflags, whichfork, diff --git a/libxfs/xfs_bmap.h b/libxfs/xfs_bmap.h index 4d48087fd3a8..b4d9c6e0f3f9 100644 --- a/libxfs/xfs_bmap.h +++ b/libxfs/xfs_bmap.h @@ -204,7 +204,7 @@ int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip, xfs_extnum_t nexts, int *done); void xfs_bmap_del_extent_delay(struct xfs_inode *ip, int whichfork, struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got, - struct xfs_bmbt_irec *del); + struct xfs_bmbt_irec *del, uint32_t bflags); void xfs_bmap_del_extent_cow(struct xfs_inode *ip, struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got, struct xfs_bmbt_irec *del);