summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_trans_extfree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_trans_extfree.c')
-rw-r--r--fs/xfs/xfs_trans_extfree.c88
1 files changed, 30 insertions, 58 deletions
diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c
index 3aca3a7578c2..7d1e84c1b848 100644
--- a/fs/xfs/xfs_trans_extfree.c
+++ b/fs/xfs/xfs_trans_extfree.c
@@ -30,61 +30,6 @@
#include "xfs_bmap.h"
/*
- * This routine is called to allocate an "extent free intention"
- * log item that will hold nextents worth of extents. The
- * caller must use all nextents extents, because we are not
- * flexible about this at all.
- */
-STATIC struct xfs_efi_log_item *
-xfs_trans_get_efi(struct xfs_trans *tp,
- uint nextents)
-{
- struct xfs_efi_log_item *efip;
-
- ASSERT(tp != NULL);
- ASSERT(nextents > 0);
-
- efip = xfs_efi_init(tp->t_mountp, nextents);
- ASSERT(efip != NULL);
-
- /*
- * Get a log_item_desc to point at the new item.
- */
- xfs_trans_add_item(tp, &efip->efi_item);
- return efip;
-}
-
-/*
- * This routine is called to indicate that the described
- * extent is to be logged as needing to be freed. It should
- * be called once for each extent to be freed.
- */
-STATIC void
-xfs_trans_log_efi_extent(struct xfs_trans *tp,
- struct xfs_efi_log_item *efip,
- xfs_fsblock_t start_block,
- xfs_extlen_t ext_len)
-{
- uint next_extent;
- struct xfs_extent *extp;
-
- tp->t_flags |= XFS_TRANS_DIRTY;
- efip->efi_item.li_desc->lid_flags |= XFS_LID_DIRTY;
-
- /*
- * atomic_inc_return gives us the value after the increment;
- * we want to use it as an array index so we need to subtract 1 from
- * it.
- */
- next_extent = atomic_inc_return(&efip->efi_next_extent) - 1;
- ASSERT(next_extent < efip->efi_format.efi_nextents);
- extp = &(efip->efi_format.efi_extents[next_extent]);
- extp->ext_start = start_block;
- extp->ext_len = ext_len;
-}
-
-
-/*
* This routine is called to allocate an "extent free done"
* log item that will hold nextents worth of extents. The
* caller must use all nextents extents, because we are not
@@ -172,7 +117,19 @@ xfs_extent_free_create_intent(
struct xfs_trans *tp,
unsigned int count)
{
- return xfs_trans_get_efi(tp, count);
+ struct xfs_efi_log_item *efip;
+
+ ASSERT(tp != NULL);
+ ASSERT(count > 0);
+
+ efip = xfs_efi_init(tp->t_mountp, count);
+ ASSERT(efip != NULL);
+
+ /*
+ * Get a log_item_desc to point at the new item.
+ */
+ xfs_trans_add_item(tp, &efip->efi_item);
+ return efip;
}
/* Log a free extent to the intent item. */
@@ -182,11 +139,26 @@ xfs_extent_free_log_item(
void *intent,
struct list_head *item)
{
+ struct xfs_efi_log_item *efip = intent;
struct xfs_extent_free_item *free;
+ uint next_extent;
+ struct xfs_extent *extp;
free = container_of(item, struct xfs_extent_free_item, xefi_list);
- xfs_trans_log_efi_extent(tp, intent, free->xefi_startblock,
- free->xefi_blockcount);
+
+ tp->t_flags |= XFS_TRANS_DIRTY;
+ efip->efi_item.li_desc->lid_flags |= XFS_LID_DIRTY;
+
+ /*
+ * atomic_inc_return gives us the value after the increment;
+ * we want to use it as an array index so we need to subtract 1 from
+ * it.
+ */
+ next_extent = atomic_inc_return(&efip->efi_next_extent) - 1;
+ ASSERT(next_extent < efip->efi_format.efi_nextents);
+ extp = &efip->efi_format.efi_extents[next_extent];
+ extp->ext_start = free->xefi_startblock;
+ extp->ext_len = free->xefi_blockcount;
}
/* Get an EFD so we can process all the free extents. */