xfs: refactor recovered EFI log item playback

Move the code that processes the log items created from the recovered
log items into the per-item source code files and use dispatch functions
to call them.  No functional changes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Darrick J. Wong
2020-05-01 16:00:50 -07:00
parent 2565a11b22
commit 10d0c6e06f
4 changed files with 45 additions and 61 deletions

View File

@@ -28,6 +28,8 @@
kmem_zone_t *xfs_efi_zone;
kmem_zone_t *xfs_efd_zone;
static const struct xfs_item_ops xfs_efi_item_ops;
static inline struct xfs_efi_log_item *EFI_ITEM(struct xfs_log_item *lip)
{
return container_of(lip, struct xfs_efi_log_item, efi_item);
@@ -51,7 +53,7 @@ xfs_efi_item_free(
* committed vs unpin operations in bulk insert operations. Hence the reference
* count to ensure only the last caller frees the EFI.
*/
void
STATIC void
xfs_efi_release(
struct xfs_efi_log_item *efip)
{
@@ -141,14 +143,6 @@ xfs_efi_item_release(
xfs_efi_release(EFI_ITEM(lip));
}
static const struct xfs_item_ops xfs_efi_item_ops = {
.iop_size = xfs_efi_item_size,
.iop_format = xfs_efi_item_format,
.iop_unpin = xfs_efi_item_unpin,
.iop_release = xfs_efi_item_release,
};
/*
* Allocate and initialize an efi item with the given number of extents.
*/
@@ -586,7 +580,7 @@ const struct xfs_defer_op_type xfs_agfl_free_defer_type = {
* Process an extent free intent item that was recovered from
* the log. We need to free the extents that it describes.
*/
int
STATIC int
xfs_efi_recover(
struct xfs_mount *mp,
struct xfs_efi_log_item *efip)
@@ -647,6 +641,38 @@ abort_error:
return error;
}
/* Recover the EFI if necessary. */
STATIC int
xfs_efi_item_recover(
struct xfs_log_item *lip,
struct xfs_trans *tp)
{
struct xfs_ail *ailp = lip->li_ailp;
struct xfs_efi_log_item *efip;
int error;
/*
* Skip EFIs that we've already processed.
*/
efip = container_of(lip, struct xfs_efi_log_item, efi_item);
if (test_bit(XFS_EFI_RECOVERED, &efip->efi_flags))
return 0;
spin_unlock(&ailp->ail_lock);
error = xfs_efi_recover(tp->t_mountp, efip);
spin_lock(&ailp->ail_lock);
return error;
}
static const struct xfs_item_ops xfs_efi_item_ops = {
.iop_size = xfs_efi_item_size,
.iop_format = xfs_efi_item_format,
.iop_unpin = xfs_efi_item_unpin,
.iop_release = xfs_efi_item_release,
.iop_recover = xfs_efi_item_recover,
};
/*
* This routine is called to create an in-core extent free intent
* item from the efi format structure which was logged on disk.