From: Darrick J. Wong <djwong@xxxxxxxxxx> 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 <hch@xxxxxx> Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- 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 d19322a0b255..36811c7fece1 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,