aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_bmap_util.c')
-rw-r--r--fs/xfs/xfs_bmap_util.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index addbd74ecd8e..6de8d90041ff 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -702,13 +702,9 @@ xfs_bmap_punch_delalloc_range(
702 struct xfs_iext_cursor icur; 702 struct xfs_iext_cursor icur;
703 int error = 0; 703 int error = 0;
704 704
705 xfs_ilock(ip, XFS_ILOCK_EXCL); 705 ASSERT(ifp->if_flags & XFS_IFEXTENTS);
706 if (!(ifp->if_flags & XFS_IFEXTENTS)) {
707 error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK);
708 if (error)
709 goto out_unlock;
710 }
711 706
707 xfs_ilock(ip, XFS_ILOCK_EXCL);
712 if (!xfs_iext_lookup_extent_before(ip, ifp, &end_fsb, &icur, &got)) 708 if (!xfs_iext_lookup_extent_before(ip, ifp, &end_fsb, &icur, &got))
713 goto out_unlock; 709 goto out_unlock;
714 710
@@ -1584,7 +1580,7 @@ xfs_swap_extent_rmap(
1584 tirec.br_blockcount, &irec, 1580 tirec.br_blockcount, &irec,
1585 &nimaps, 0); 1581 &nimaps, 0);
1586 if (error) 1582 if (error)
1587 goto out_defer; 1583 goto out;
1588 ASSERT(nimaps == 1); 1584 ASSERT(nimaps == 1);
1589 ASSERT(tirec.br_startoff == irec.br_startoff); 1585 ASSERT(tirec.br_startoff == irec.br_startoff);
1590 trace_xfs_swap_extent_rmap_remap_piece(ip, &irec); 1586 trace_xfs_swap_extent_rmap_remap_piece(ip, &irec);
@@ -1599,22 +1595,22 @@ xfs_swap_extent_rmap(
1599 /* Remove the mapping from the donor file. */ 1595 /* Remove the mapping from the donor file. */
1600 error = xfs_bmap_unmap_extent(tp, tip, &uirec); 1596 error = xfs_bmap_unmap_extent(tp, tip, &uirec);
1601 if (error) 1597 if (error)
1602 goto out_defer; 1598 goto out;
1603 1599
1604 /* Remove the mapping from the source file. */ 1600 /* Remove the mapping from the source file. */
1605 error = xfs_bmap_unmap_extent(tp, ip, &irec); 1601 error = xfs_bmap_unmap_extent(tp, ip, &irec);
1606 if (error) 1602 if (error)
1607 goto out_defer; 1603 goto out;
1608 1604
1609 /* Map the donor file's blocks into the source file. */ 1605 /* Map the donor file's blocks into the source file. */
1610 error = xfs_bmap_map_extent(tp, ip, &uirec); 1606 error = xfs_bmap_map_extent(tp, ip, &uirec);
1611 if (error) 1607 if (error)
1612 goto out_defer; 1608 goto out;
1613 1609
1614 /* Map the source file's blocks into the donor file. */ 1610 /* Map the source file's blocks into the donor file. */
1615 error = xfs_bmap_map_extent(tp, tip, &irec); 1611 error = xfs_bmap_map_extent(tp, tip, &irec);
1616 if (error) 1612 if (error)
1617 goto out_defer; 1613 goto out;
1618 1614
1619 error = xfs_defer_finish(tpp); 1615 error = xfs_defer_finish(tpp);
1620 tp = *tpp; 1616 tp = *tpp;
@@ -1636,8 +1632,6 @@ xfs_swap_extent_rmap(
1636 tip->i_d.di_flags2 = tip_flags2; 1632 tip->i_d.di_flags2 = tip_flags2;
1637 return 0; 1633 return 0;
1638 1634
1639out_defer:
1640 xfs_defer_cancel(tp);
1641out: 1635out:
1642 trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_); 1636 trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_);
1643 tip->i_d.di_flags2 = tip_flags2; 1637 tip->i_d.di_flags2 = tip_flags2;