From: Darrick J. Wong Date: Fri, 17 Nov 2023 17:34:10 +0000 (-0800) Subject: xfs: reuse xfs_rmap_update_cancel_item X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=650d6d0fd5bd462eae32b82d0a610f6689bb74fa;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 55b079224..d86aced2b 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -333,6 +333,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( @@ -346,8 +357,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; } @@ -358,17 +368,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 = { .create_intent = xfs_rmap_update_create_intent, .abort_intent = xfs_rmap_update_abort_intent,