summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2016-08-03 12:30:31 +1000
committerDave Chinner <david@fromorbit.com>2016-08-03 12:30:31 +1000
commit51ce9d000c0a80bddf9a93a4232283cc9a4564c0 (patch)
tree9986b59cc53e7bec56f5b14468204e22ba33ad13
parente127fafd1d3c46532903d530dfa69822d3d35d8a (diff)
xfs: collapse single use static functions
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r--fs/xfs/xfs_trans_extfree.c88
-rw-r--r--fs/xfs/xfs_trans_rmap.c103
2 files changed, 63 insertions, 128 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. */
diff --git a/fs/xfs/xfs_trans_rmap.c b/fs/xfs/xfs_trans_rmap.c
index 35650d6b2606..5a50ef881568 100644
--- a/fs/xfs/xfs_trans_rmap.c
+++ b/fs/xfs/xfs_trans_rmap.c
@@ -31,32 +31,6 @@
#include "xfs_alloc.h"
#include "xfs_rmap.h"
-/*
- * This routine is called to allocate an "rmap update intent"
- * 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_rui_log_item *
-xfs_trans_get_rui(
- struct xfs_trans *tp,
- uint nextents)
-{
- struct xfs_rui_log_item *ruip;
-
- ASSERT(tp != NULL);
- ASSERT(nextents > 0);
-
- ruip = xfs_rui_init(tp->t_mountp, nextents);
- ASSERT(ruip != NULL);
-
- /*
- * Get a log_item_desc to point at the new item.
- */
- xfs_trans_add_item(tp, &ruip->rui_item);
- return ruip;
-}
-
/* Set the map extent flags for this reverse mapping. */
static void
xfs_trans_set_rmap_flags(
@@ -91,44 +65,6 @@ xfs_trans_set_rmap_flags(
}
}
-/*
- * This routine is called to indicate that the described reverse
- * mapping is to be logged as needing to be updated. It should be
- * called once for each mapping.
- */
-STATIC void
-xfs_trans_log_start_rmap_update(
- struct xfs_trans *tp,
- struct xfs_rui_log_item *ruip,
- enum xfs_rmap_intent_type type,
- __uint64_t owner,
- int whichfork,
- xfs_fileoff_t startoff,
- xfs_fsblock_t startblock,
- xfs_filblks_t blockcount,
- xfs_exntst_t state)
-{
- uint next_extent;
- struct xfs_map_extent *rmap;
-
- tp->t_flags |= XFS_TRANS_DIRTY;
- ruip->rui_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(&ruip->rui_next_extent) - 1;
- ASSERT(next_extent < ruip->rui_format.rui_nextents);
- rmap = &(ruip->rui_format.rui_extents[next_extent]);
- rmap->me_owner = owner;
- rmap->me_startblock = startblock;
- rmap->me_startoff = startoff;
- rmap->me_len = blockcount;
- xfs_trans_set_rmap_flags(rmap, type, whichfork, state);
-}
-
struct xfs_rud_log_item *
xfs_trans_get_rud(
struct xfs_trans *tp,
@@ -200,7 +136,19 @@ xfs_rmap_update_create_intent(
struct xfs_trans *tp,
unsigned int count)
{
- return xfs_trans_get_rui(tp, count);
+ struct xfs_rui_log_item *ruip;
+
+ ASSERT(tp != NULL);
+ ASSERT(count > 0);
+
+ ruip = xfs_rui_init(tp->t_mountp, count);
+ ASSERT(ruip != NULL);
+
+ /*
+ * Get a log_item_desc to point at the new item.
+ */
+ xfs_trans_add_item(tp, &ruip->rui_item);
+ return ruip;
}
/* Log rmap updates in the intent item. */
@@ -210,14 +158,29 @@ xfs_rmap_update_log_item(
void *intent,
struct list_head *item)
{
+ struct xfs_rui_log_item *ruip = intent;
struct xfs_rmap_intent *rmap;
+ uint next_extent;
+ struct xfs_map_extent *map;
rmap = container_of(item, struct xfs_rmap_intent, ri_list);
- xfs_trans_log_start_rmap_update(tp, intent, rmap->ri_type,
- rmap->ri_owner, rmap->ri_whichfork,
- rmap->ri_bmap.br_startoff,
- rmap->ri_bmap.br_startblock,
- rmap->ri_bmap.br_blockcount,
+
+ tp->t_flags |= XFS_TRANS_DIRTY;
+ ruip->rui_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(&ruip->rui_next_extent) - 1;
+ ASSERT(next_extent < ruip->rui_format.rui_nextents);
+ map = &ruip->rui_format.rui_extents[next_extent];
+ map->me_owner = rmap->ri_owner;
+ map->me_startblock = rmap->ri_bmap.br_startblock;
+ map->me_startoff = rmap->ri_bmap.br_startoff;
+ map->me_len = rmap->ri_bmap.br_blockcount;
+ xfs_trans_set_rmap_flags(map, rmap->ri_type, rmap->ri_whichfork,
rmap->ri_bmap.br_state);
}