From b97324b82b5975a617b5bd511f3b264ef4b3a427 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Mon, 22 Apr 2024 10:01:15 -0700 Subject: [PATCH] libxfs: reuse xfs_bmap_update_cancel_item Reuse xfs_bmap_update_cancel_item to put the AG/RTG and free the item in a few places that currently open code the logic. Inspired-by: Christoph Hellwig Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxfs/defer_item.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index d19322a0b..36811c7fe 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -522,6 +522,17 @@ xfs_bmap_update_put_group( xfs_perag_intent_put(bi->bi_pag); } +/* Cancel a deferred rmap update. */ +STATIC void +xfs_bmap_update_cancel_item( + struct list_head *item) +{ + struct xfs_bmap_intent *bi = bi_entry(item); + + xfs_bmap_update_put_group(bi); + kmem_cache_free(xfs_bmap_intent_cache, bi); +} + /* Process a deferred rmap update. */ STATIC int xfs_bmap_update_finish_item( @@ -539,8 +550,7 @@ xfs_bmap_update_finish_item( return -EAGAIN; } - xfs_bmap_update_put_group(bi); - kmem_cache_free(xfs_bmap_intent_cache, bi); + xfs_bmap_update_cancel_item(item); return error; } @@ -551,17 +561,6 @@ xfs_bmap_update_abort_intent( { } -/* Cancel a deferred rmap update. */ -STATIC void -xfs_bmap_update_cancel_item( - struct list_head *item) -{ - struct xfs_bmap_intent *bi = bi_entry(item); - - xfs_bmap_update_put_group(bi); - kmem_cache_free(xfs_bmap_intent_cache, bi); -} - const struct xfs_defer_op_type xfs_bmap_update_defer_type = { .name = "bmap", .create_intent = xfs_bmap_update_create_intent, -- 2.39.5