From: Christoph Hellwig Date: Wed, 14 Mar 2018 06:15:33 +0000 (-0700) Subject: xfs: minor cleanup for xfs_reflink_end_cow X-Git-Tag: v4.19~1210^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df79b81b2e6a801c134c3e06c647715a316b4a92;p=platform%2Fkernel%2Flinux-rpi.git 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: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 90aac88..cdbd342 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -762,10 +762,8 @@ xfs_reflink_end_cow( xfs_trim_extent(&del, offset_fsb, end_fsb - offset_fsb); /* Extent delete may have bumped ext forward */ - if (!del.br_blockcount) { - xfs_iext_prev(ifp, &icur); - goto next_extent; - } + if (!del.br_blockcount) + goto prev_extent; ASSERT(!isnullstartblock(got.br_startblock)); @@ -774,10 +772,8 @@ xfs_reflink_end_cow( * speculatively preallocated CoW extents that have been * allocated but have not yet been involved in a write. */ - if (got.br_state == XFS_EXT_UNWRITTEN) { - xfs_iext_prev(ifp, &icur); - goto next_extent; - } + if (got.br_state == XFS_EXT_UNWRITTEN) + goto prev_extent; /* Unmap the old blocks in the data fork. */ xfs_defer_init(&dfops, &firstfsb); @@ -816,9 +812,12 @@ xfs_reflink_end_cow( error = xfs_defer_finish(&tp, &dfops); if (error) goto out_defer; -next_extent: if (!xfs_iext_get_extent(ifp, &icur, &got)) break; + continue; +prev_extent: + if (!xfs_iext_prev_extent(ifp, &icur, &got)) + break; } error = xfs_trans_commit(tp);