xfs: refactor intent item iop_recover calls

Now that we've made the recovered item tests all the same, we can hoist
the test and the ail locking code to the ->iop_recover caller and call
the recovery function directly.

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:55 -07:00
parent 889eb55dd6
commit 96b60f8267
5 changed files with 55 additions and 138 deletions

View File

@@ -581,16 +581,18 @@ const struct xfs_defer_op_type xfs_agfl_free_defer_type = {
* the log. We need to free the extents that it describes.
*/
STATIC int
xfs_efi_recover(
struct xfs_mount *mp,
struct xfs_efi_log_item *efip)
xfs_efi_item_recover(
struct xfs_log_item *lip,
struct xfs_trans *parent_tp)
{
struct xfs_efd_log_item *efdp;
struct xfs_trans *tp;
int i;
int error = 0;
xfs_extent_t *extp;
xfs_fsblock_t startblock_fsb;
struct xfs_efi_log_item *efip = EFI_ITEM(lip);
struct xfs_mount *mp = parent_tp->t_mountp;
struct xfs_efd_log_item *efdp;
struct xfs_trans *tp;
struct xfs_extent *extp;
xfs_fsblock_t startblock_fsb;
int i;
int error = 0;
ASSERT(!test_bit(XFS_LI_RECOVERED, &efip->efi_item.li_flags));
@@ -641,30 +643,6 @@ 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_LI_RECOVERED, &efip->efi_item.li_flags))
return 0;
spin_unlock(&ailp->ail_lock);
error = xfs_efi_recover(tp->t_mountp, efip);
spin_lock(&ailp->ail_lock);
return error;
}
STATIC bool
xfs_efi_item_match(
struct xfs_log_item *lip,