From: Christoph Hellwig Date: Wed, 3 Jul 2024 21:21:40 +0000 (-0700) Subject: xfs: reuse xfs_rmap_update_cancel_item X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2f7812dff58cc1ce972a14434dbd83e231e63b43;p=users%2Fhch%2Fxfsprogs.git xfs: reuse xfs_rmap_update_cancel_item Reuse xfs_rmap_update_cancel_item to put the AG/RTG and free the item in a few places that currently open code the logic. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index 21465f1a7..eb38cf13f 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -260,6 +260,17 @@ xfs_rmap_update_put_group( xfs_perag_intent_put(ri->ri_pag); } +/* Cancel a deferred rmap update. */ +STATIC void +xfs_rmap_update_cancel_item( + struct list_head *item) +{ + struct xfs_rmap_intent *ri = ri_entry(item); + + xfs_rmap_update_put_group(ri); + kmem_cache_free(xfs_rmap_intent_cache, ri); +} + /* Process a deferred rmap update. */ STATIC int xfs_rmap_update_finish_item( @@ -273,8 +284,7 @@ xfs_rmap_update_finish_item( error = xfs_rmap_finish_one(tp, ri, state); - xfs_rmap_update_put_group(ri); - kmem_cache_free(xfs_rmap_intent_cache, ri); + xfs_rmap_update_cancel_item(item); return error; } @@ -285,17 +295,6 @@ xfs_rmap_update_abort_intent( { } -/* Cancel a deferred rmap update. */ -STATIC void -xfs_rmap_update_cancel_item( - struct list_head *item) -{ - struct xfs_rmap_intent *ri = ri_entry(item); - - xfs_rmap_update_put_group(ri); - kmem_cache_free(xfs_rmap_intent_cache, ri); -} - const struct xfs_defer_op_type xfs_rmap_update_defer_type = { .name = "rmap", .create_intent = xfs_rmap_update_create_intent,