Skip to content

Commit 61665fa

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: reuse xfs_extent_free_cancel_item
Reuse xfs_extent_free_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 <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 649c0c2 commit 61665fa

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

fs/xfs/xfs_extfree_item.c

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,17 @@ xfs_extent_free_put_group(
437437
xfs_perag_intent_put(xefi->xefi_pag);
438438
}
439439

440+
/* Cancel a free extent. */
441+
STATIC void
442+
xfs_extent_free_cancel_item(
443+
struct list_head *item)
444+
{
445+
struct xfs_extent_free_item *xefi = xefi_entry(item);
446+
447+
xfs_extent_free_put_group(xefi);
448+
kmem_cache_free(xfs_extfree_item_cache, xefi);
449+
}
450+
440451
/* Process a free extent. */
441452
STATIC int
442453
xfs_extent_free_finish_item(
@@ -487,8 +498,7 @@ xfs_extent_free_finish_item(
487498
extp->ext_len = xefi->xefi_blockcount;
488499
efdp->efd_next_extent++;
489500

490-
xfs_extent_free_put_group(xefi);
491-
kmem_cache_free(xfs_extfree_item_cache, xefi);
501+
xfs_extent_free_cancel_item(item);
492502
return error;
493503
}
494504

@@ -500,17 +510,6 @@ xfs_extent_free_abort_intent(
500510
xfs_efi_release(EFI_ITEM(intent));
501511
}
502512

503-
/* Cancel a free extent. */
504-
STATIC void
505-
xfs_extent_free_cancel_item(
506-
struct list_head *item)
507-
{
508-
struct xfs_extent_free_item *xefi = xefi_entry(item);
509-
510-
xfs_extent_free_put_group(xefi);
511-
kmem_cache_free(xfs_extfree_item_cache, xefi);
512-
}
513-
514513
/*
515514
* AGFL blocks are accounted differently in the reserve pools and are not
516515
* inserted into the busy extent list.
@@ -550,8 +549,7 @@ xfs_agfl_free_finish_item(
550549
extp->ext_len = xefi->xefi_blockcount;
551550
efdp->efd_next_extent++;
552551

553-
xfs_extent_free_put_group(xefi);
554-
kmem_cache_free(xfs_extfree_item_cache, xefi);
552+
xfs_extent_free_cancel_item(&xefi->xefi_list);
555553
return error;
556554
}
557555

0 commit comments

Comments
 (0)