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>
This commit is contained in:
Darrick J. Wong
2016-08-03 12:30:31 +10:00
committed by Dave Chinner
parent e127fafd1d
commit 51ce9d000c
2 changed files with 63 additions and 128 deletions

View File

@@ -29,61 +29,6 @@
#include "xfs_alloc.h"
#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
@@ -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. */