From mboxrd@z Thu Jan 1 00:00:00 1970 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 1CCCB125A3 for ; Fri, 23 Feb 2024 07:15:55 +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=1708672557; cv=none; b=Sxtr66vOINHjujyDuhU36vAy+JqYY/vnBs30iliO8kT/NdCZlci5gUuwPkDg2m4EwOz9+6MVPVM5RoN/8oDYXPi4ThID0XcEEG+cVz4q1sdGh8Lf3fAOiZyPHKKhD2IkDd+IeJl2oBeYuVQvpYYECRVq//Nqm6AcybBmdl6J6Fs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708672557; c=relaxed/simple; bh=SCUv/xvkY85eU/KiSYevi/a9hAfIscNoZg/mncU9RUg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OtI0qwn2z9eMXziz7ieRhexeaJ+DFPogFn07QDCqZaweu5tMeC3Gjj967yYQhcAPaAkwu7zzsfMxUCIhKz68dUpHZReXc2Smlt1DaNEIJKCBQ+3Gmkab3QBFSKj1A+a3HqP+krQzbu0sp631GahuULt3kg66gAFj3JdR1fTSKbE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (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=iOG1zmdn; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (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="iOG1zmdn" 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=cJwY36xS6PvSp/vYl1CKsXpJr62awfAoGAkIx8s/cLY=; b=iOG1zmdnBbPQn3m0ABk8kDoj7Q ths5lsLP2VfGTED4sW0k2kTLxc0RQhkaCwVEbDzNhqp+9D9nkzl3hGwa+jgExCqQm0DxDJ/u0ZbvW VtCmXJYcCVXd3yBbJ+91tUbgNgykj06bKQbB0DGjHnofIDGfQPf9f9TxNGt+I+dnEkKZ6iFcpxefg Jrw2Ry96MsivI/3esPasTeTiS5r7qpOrTejUSSc0QK1jxqmzGw+ZnaKEA0ck5spSH0vZQmowvtLsM 1C5oG/N+/mjTE51JvUETQQIVr/UxHK6ln/q0xIL1I4gfdxSxXbnZlFhmNgl8hGne5L3AubYumdRVb C87KLvcw==; Received: from [2001:4bb8:19a:62b2:c70:4a89:bc61:3] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdPml-00000008Gud-0pTd; Fri, 23 Feb 2024 07:15:55 +0000 From: Christoph Hellwig To: Chandan Babu R Cc: "Darrick J. Wong" , Dave Chinner , linux-xfs@vger.kernel.org Subject: [PATCH 05/10] xfs: reinstate RT support in xfs_bmapi_reserve_delalloc Date: Fri, 23 Feb 2024 08:15:01 +0100 Message-Id: <20240223071506.3968029-6-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240223071506.3968029-1-hch@lst.de> References: <20240223071506.3968029-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Allocate data blocks for RT inodes using xfs_dec_frextents. While at it optimize the data device case by doing only a single xfs_dec_fdblocks call for the extent itself and the indirect blocks. Signed-off-by: Christoph Hellwig --- fs/xfs/libxfs/xfs_bmap.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index cc788cde8bffd6..95e93534cd1264 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3984,6 +3984,7 @@ xfs_bmapi_reserve_delalloc( struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); xfs_extlen_t alen; xfs_extlen_t indlen; + uint64_t fdblocks; int error; xfs_fileoff_t aoff = off; @@ -4026,14 +4027,18 @@ xfs_bmapi_reserve_delalloc( indlen = (xfs_extlen_t)xfs_bmap_worst_indlen(ip, alen); ASSERT(indlen > 0); - error = xfs_dec_fdblocks(mp, alen, false); - if (error) - goto out_unreserve_quota; + fdblocks = indlen; + if (XFS_IS_REALTIME_INODE(ip)) { + error = xfs_dec_frextents(mp, xfs_rtb_to_rtx(mp, alen)); + if (error) + goto out_unreserve_quota; + } else { + fdblocks += alen; + } - error = xfs_dec_fdblocks(mp, indlen, false); + error = xfs_dec_fdblocks(mp, fdblocks, false); if (error) - goto out_unreserve_blocks; - + goto out_unreserve_frextents; ip->i_delayed_blks += alen; xfs_mod_delalloc(ip->i_mount, alen + indlen); @@ -4057,8 +4062,9 @@ xfs_bmapi_reserve_delalloc( return 0; -out_unreserve_blocks: - xfs_add_fdblocks(mp, alen); +out_unreserve_frextents: + if (XFS_IS_REALTIME_INODE(ip)) + xfs_add_frextents(mp, xfs_rtb_to_rtx(mp, alen)); out_unreserve_quota: if (XFS_IS_QUOTA_ON(mp)) xfs_quota_unreserve_blkres(ip, alen); -- 2.39.2