]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: simplify the rmap code in xfs_bmse_merge
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)
committerEric Sandeen <sandeen@redhat.com>
Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_bmap.c

index e578bafd341806c150232d00a660a4c18ffeefdd..443b9540deda7c60589c8670a1206e2c4301f5a4 100644 (file)
@@ -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);
 }