From: Darrick J. Wong Date: Wed, 18 Oct 2017 18:39:01 +0000 (-0500) Subject: xfs: simplify the rmap code in xfs_bmse_merge X-Git-Tag: v4.14.0-rc1~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=479284b7ca724d31a28ce3370d51566a59e3960a;p=thirdparty%2Fxfsprogs-dev.git xfs: simplify the rmap code in xfs_bmse_merge Source kernel commit: 4cc1ee5e654114aa7fac6993488ad2cd0b3411bb 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 Reviewed-by: Christoph Hellwig Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index e578bafd3..443b9540d 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -5933,13 +5933,12 @@ done: 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); }