Skip to content

Commit

Permalink
xfs: simplify the rmap code in xfs_bmse_merge
Browse files Browse the repository at this point in the history
In Christoph's patch to refactor xfs_bmse_merge, the updated rmap code
does more work than it needs to (because map-extent auto-merges
records).  Remove the unnecessary unmap and save ourselves a deferred
op.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Darrick J. Wong committed Sep 1, 2017
1 parent f91fb95 commit 4cc1ee5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/xfs/libxfs/xfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -5942,13 +5942,12 @@ xfs_bmse_merge(
xfs_iext_update_extent(ifp, current_ext - 1, &new);
xfs_iext_remove(ip, current_ext, 1, 0);

/* update reverse mapping */
/* update reverse mapping. rmap functions merge the rmaps for us */
error = xfs_rmap_unmap_extent(mp, dfops, ip, whichfork, got);
if (error)
return error;
error = xfs_rmap_unmap_extent(mp, dfops, ip, whichfork, left);
if (error)
return error;
memcpy(&new, got, sizeof(new));
new.br_startoff = left->br_startoff + left->br_blockcount;
return xfs_rmap_map_extent(mp, dfops, ip, whichfork, &new);
}

Expand Down

0 comments on commit 4cc1ee5

Please sign in to comment.