]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: support RT inodes in xfs_mod_delalloc
authorChristoph Hellwig <hch@lst.de>
Mon, 29 Jul 2024 23:22:42 +0000 (16:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:01 +0000 (17:01 -0700)
Source kernel commit: 7099bd0f243fa7511de6e95b0b8807ba7d3e5204

To prepare for re-enabling delalloc on RT devices, track the data blocks
(which use the RT device when the inode sits on it) and the indirect
blocks (which don't) separately to xfs_mod_delalloc, and add a new
percpu counter to also track the RT delalloc blocks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
libxfs/libxfs_priv.h
libxfs/xfs_bmap.c

index 40c418f5448beec70b992a552459229c941f7d11..cfe96b05a49bd3b133fc32c59d6ac45e55df70b5 100644 (file)
@@ -141,7 +141,7 @@ enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC };
 
 
 #define xfs_force_shutdown(d,n)                ((void) 0)
-#define xfs_mod_delalloc(a,b)          ((void) 0)
+#define xfs_mod_delalloc(a,b,c)                ((void) 0)
 
 /* stop unused var warnings by assigning mp to itself */
 
index 5de8c72a84d83d850ab672197f6892e2a218a974..79cde87d0eb7b62ff76fc5aad964674ac5b228c7 100644 (file)
@@ -1971,7 +1971,7 @@ xfs_bmap_add_extent_delay_real(
        }
 
        if (da_new != da_old)
-               xfs_mod_delalloc(mp, (int64_t)da_new - da_old);
+               xfs_mod_delalloc(bma->ip, 0, (int64_t)da_new - da_old);
 
        if (bma->cur) {
                da_new += bma->cur->bc_bmap.allocated;
@@ -2690,7 +2690,7 @@ xfs_bmap_add_extent_hole_delay(
                /*
                 * Nothing to do for disk quota accounting here.
                 */
-               xfs_mod_delalloc(ip->i_mount, (int64_t)newlen - oldlen);
+               xfs_mod_delalloc(ip, 0, (int64_t)newlen - oldlen);
        }
 }
 
@@ -3367,7 +3367,7 @@ xfs_bmap_alloc_account(
                 * yet.
                 */
                if (ap->wasdel) {
-                       xfs_mod_delalloc(ap->ip->i_mount, -(int64_t)ap->length);
+                       xfs_mod_delalloc(ap->ip, -(int64_t)ap->length, 0);
                        return;
                }
 
@@ -3391,7 +3391,7 @@ xfs_bmap_alloc_account(
        xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE);
        if (ap->wasdel) {
                ap->ip->i_delayed_blks -= ap->length;
-               xfs_mod_delalloc(ap->ip->i_mount, -(int64_t)ap->length);
+               xfs_mod_delalloc(ap->ip, -(int64_t)ap->length, 0);
                fld = isrt ? XFS_TRANS_DQ_DELRTBCOUNT : XFS_TRANS_DQ_DELBCOUNT;
        } else {
                fld = isrt ? XFS_TRANS_DQ_RTBCOUNT : XFS_TRANS_DQ_BCOUNT;
@@ -4120,7 +4120,7 @@ xfs_bmapi_reserve_delalloc(
                goto out_unreserve_frextents;
 
        ip->i_delayed_blks += alen;
-       xfs_mod_delalloc(ip->i_mount, alen + indlen);
+       xfs_mod_delalloc(ip, alen, indlen);
 
        got->br_startoff = aoff;
        got->br_startblock = nullstartblock(indlen);
@@ -5018,7 +5018,7 @@ xfs_bmap_del_extent_delay(
                fdblocks += del->br_blockcount;
 
        xfs_add_fdblocks(mp, fdblocks);
-       xfs_mod_delalloc(mp, -(int64_t)fdblocks);
+       xfs_mod_delalloc(ip, -(int64_t)del->br_blockcount, -da_diff);
        return error;
 }