diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-07-02 20:22:56 +0200 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-07-02 20:37:03 +0200 |
commit | 84a3c1576c5aade32170fae6c61d51bd2d16010f (patch) | |
tree | 0412c6dbf69b33bf4447a304a91a9f6b173e065a /fs/xfs/xfs_extfree_item.c | |
parent | xfs: remove xfs_defer_agfl_block (diff) | |
download | linux-84a3c1576c5aade32170fae6c61d51bd2d16010f.tar.xz linux-84a3c1576c5aade32170fae6c61d51bd2d16010f.zip |
xfs: move xfs_extent_free_defer_add to xfs_extfree_item.c
Move the code that adds the incore xfs_extent_free_item deferred work
data to a transaction to live with the EFI log item code. This means
that the allocator code no longer has to know about the inner workings
of the EFI log items.
As a consequence, we can get rid of the _{get,put}_group helpers.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_extfree_item.c')
-rw-r--r-- | fs/xfs/xfs_extfree_item.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c index c755037a64d2..abffc74a924f 100644 --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c @@ -436,21 +436,24 @@ xfs_extent_free_create_done( return &efdp->efd_item; } -/* Take a passive ref to the AG containing the space we're freeing. */ +/* Add this deferred EFI to the transaction. */ void -xfs_extent_free_get_group( - struct xfs_mount *mp, - struct xfs_extent_free_item *xefi) +xfs_extent_free_defer_add( + struct xfs_trans *tp, + struct xfs_extent_free_item *xefi, + struct xfs_defer_pending **dfpp) { - xefi->xefi_pag = xfs_perag_intent_get(mp, xefi->xefi_startblock); -} + struct xfs_mount *mp = tp->t_mountp; -/* Release a passive AG ref after some freeing work. */ -static inline void -xfs_extent_free_put_group( - struct xfs_extent_free_item *xefi) -{ - xfs_perag_intent_put(xefi->xefi_pag); + trace_xfs_extent_free_defer(mp, xefi); + + xefi->xefi_pag = xfs_perag_intent_get(mp, xefi->xefi_startblock); + if (xefi->xefi_agresv == XFS_AG_RESV_AGFL) + *dfpp = xfs_defer_add(tp, &xefi->xefi_list, + &xfs_agfl_free_defer_type); + else + *dfpp = xfs_defer_add(tp, &xefi->xefi_list, + &xfs_extent_free_defer_type); } /* Cancel a free extent. */ @@ -460,7 +463,7 @@ xfs_extent_free_cancel_item( { struct xfs_extent_free_item *xefi = xefi_entry(item); - xfs_extent_free_put_group(xefi); + xfs_perag_intent_put(xefi->xefi_pag); kmem_cache_free(xfs_extfree_item_cache, xefi); } @@ -575,7 +578,7 @@ xfs_efi_recover_work( xefi->xefi_blockcount = extp->ext_len; xefi->xefi_agresv = XFS_AG_RESV_NONE; xefi->xefi_owner = XFS_RMAP_OWN_UNKNOWN; - xfs_extent_free_get_group(mp, xefi); + xefi->xefi_pag = xfs_perag_intent_get(mp, extp->ext_start); xfs_defer_add_item(dfp, &xefi->xefi_list); } |