Commit df79b81b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: minor cleanup for xfs_reflink_end_cow

Use xfs_iext_prev_extent to skip to the previous extent instead of
opencoding it.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 1d4352de
...@@ -762,10 +762,8 @@ xfs_reflink_end_cow( ...@@ -762,10 +762,8 @@ xfs_reflink_end_cow(
xfs_trim_extent(&del, offset_fsb, end_fsb - offset_fsb); xfs_trim_extent(&del, offset_fsb, end_fsb - offset_fsb);
/* Extent delete may have bumped ext forward */ /* Extent delete may have bumped ext forward */
if (!del.br_blockcount) { if (!del.br_blockcount)
xfs_iext_prev(ifp, &icur); goto prev_extent;
goto next_extent;
}
ASSERT(!isnullstartblock(got.br_startblock)); ASSERT(!isnullstartblock(got.br_startblock));
...@@ -774,10 +772,8 @@ xfs_reflink_end_cow( ...@@ -774,10 +772,8 @@ xfs_reflink_end_cow(
* speculatively preallocated CoW extents that have been * speculatively preallocated CoW extents that have been
* allocated but have not yet been involved in a write. * allocated but have not yet been involved in a write.
*/ */
if (got.br_state == XFS_EXT_UNWRITTEN) { if (got.br_state == XFS_EXT_UNWRITTEN)
xfs_iext_prev(ifp, &icur); goto prev_extent;
goto next_extent;
}
/* Unmap the old blocks in the data fork. */ /* Unmap the old blocks in the data fork. */
xfs_defer_init(&dfops, &firstfsb); xfs_defer_init(&dfops, &firstfsb);
...@@ -816,9 +812,12 @@ xfs_reflink_end_cow( ...@@ -816,9 +812,12 @@ xfs_reflink_end_cow(
error = xfs_defer_finish(&tp, &dfops); error = xfs_defer_finish(&tp, &dfops);
if (error) if (error)
goto out_defer; goto out_defer;
next_extent:
if (!xfs_iext_get_extent(ifp, &icur, &got)) if (!xfs_iext_get_extent(ifp, &icur, &got))
break; break;
continue;
prev_extent:
if (!xfs_iext_prev_extent(ifp, &icur, &got))
break;
} }
error = xfs_trans_commit(tp); error = xfs_trans_commit(tp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment