Commit 384ff09b authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: don't release log intent items when recovery fails



Nowadays, log recovery will call ->release on the recovered intent items
if recovery fails.  Therefore, it's redundant to release them from
inside the ->recover functions when they're about to return an error.

Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 2dbf872c
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -444,10 +444,8 @@ xfs_bui_item_recover(
	int				error = 0;

	/* Only one mapping operation per BUI... */
	if (buip->bui_format.bui_nextents != XFS_BUI_MAX_FAST_EXTENTS) {
		xfs_bui_release(buip);
	if (buip->bui_format.bui_nextents != XFS_BUI_MAX_FAST_EXTENTS)
		return -EFSCORRUPTED;
	}

	/*
	 * First check the validity of the extent described by the
@@ -473,14 +471,8 @@ xfs_bui_item_recover(
	    startblock_fsb >= mp->m_sb.sb_dblocks ||
	    bmap->me_len >= mp->m_sb.sb_agblocks ||
	    inode_fsb >= mp->m_sb.sb_dblocks ||
	    (bmap->me_flags & ~XFS_BMAP_EXTENT_FLAGS)) {
		/*
		 * This will pull the BUI from the AIL and
		 * free the memory associated with it.
		 */
		xfs_bui_release(buip);
	    (bmap->me_flags & ~XFS_BMAP_EXTENT_FLAGS))
		return -EFSCORRUPTED;
	}

	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
			XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK), 0, 0, &tp);
+1 −7
Original line number Diff line number Diff line
@@ -608,15 +608,9 @@ xfs_efi_item_recover(
		if (startblock_fsb == 0 ||
		    extp->ext_len == 0 ||
		    startblock_fsb >= mp->m_sb.sb_dblocks ||
		    extp->ext_len >= mp->m_sb.sb_agblocks) {
			/*
			 * This will pull the EFI from the AIL and
			 * free the memory associated with it.
			 */
			xfs_efi_release(efip);
		    extp->ext_len >= mp->m_sb.sb_agblocks)
			return -EFSCORRUPTED;
	}
	}

	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
	if (error)
+1 −7
Original line number Diff line number Diff line
@@ -467,15 +467,9 @@ xfs_cui_item_recover(
		    refc->pe_len == 0 ||
		    startblock_fsb >= mp->m_sb.sb_dblocks ||
		    refc->pe_len >= mp->m_sb.sb_agblocks ||
		    (refc->pe_flags & ~XFS_REFCOUNT_EXTENT_FLAGS)) {
			/*
			 * This will pull the CUI from the AIL and
			 * free the memory associated with it.
			 */
			xfs_cui_release(cuip);
		    (refc->pe_flags & ~XFS_REFCOUNT_EXTENT_FLAGS))
			return -EFSCORRUPTED;
	}
	}

	/*
	 * Under normal operation, refcount updates are deferred, so we
+1 −7
Original line number Diff line number Diff line
@@ -511,15 +511,9 @@ xfs_rui_item_recover(
		    rmap->me_len == 0 ||
		    startblock_fsb >= mp->m_sb.sb_dblocks ||
		    rmap->me_len >= mp->m_sb.sb_agblocks ||
		    (rmap->me_flags & ~XFS_RMAP_EXTENT_FLAGS)) {
			/*
			 * This will pull the RUI from the AIL and
			 * free the memory associated with it.
			 */
			xfs_rui_release(ruip);
		    (rmap->me_flags & ~XFS_RMAP_EXTENT_FLAGS))
			return -EFSCORRUPTED;
	}
	}

	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
			mp->m_rmap_maxlevels, 0, XFS_TRANS_RESERVE, &tp);