From f36ccac2fcfb131ebc9ceb9bde9a586ea8207417 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 16 Nov 2017 22:11:33 -0600 Subject: [PATCH] xfs: update got in xfs_bmap_shift_update_extent Source kernel commit: 11f75b3bbad57998d1af99391ec3a8e076ab4dd9 This way the caller gets the proper updated extent returned in got. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- libxfs/xfs_bmap.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 606d6bf4d..403858dc5 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -5582,35 +5582,33 @@ xfs_bmap_shift_update_extent( xfs_fileoff_t startoff) { struct xfs_mount *mp = ip->i_mount; - struct xfs_bmbt_irec new; + struct xfs_bmbt_irec prev = *got; int error, i; *logflags |= XFS_ILOG_CORE; - new = *got; - new.br_startoff = startoff; + got->br_startoff = startoff; if (cur) { - error = xfs_bmbt_lookup_eq(cur, got, &i); + error = xfs_bmbt_lookup_eq(cur, &prev, &i); if (error) return error; XFS_WANT_CORRUPTED_RETURN(mp, i == 1); - error = xfs_bmbt_update(cur, &new); + error = xfs_bmbt_update(cur, got); if (error) return error; } else { *logflags |= XFS_ILOG_DEXT; } - xfs_iext_update_extent(ip, xfs_bmap_fork_to_state(whichfork), idx, - &new); + xfs_iext_update_extent(ip, xfs_bmap_fork_to_state(whichfork), idx, got); /* update reverse mapping */ - error = xfs_rmap_unmap_extent(mp, dfops, ip, whichfork, got); + error = xfs_rmap_unmap_extent(mp, dfops, ip, whichfork, &prev); if (error) return error; - return xfs_rmap_map_extent(mp, dfops, ip, whichfork, &new); + return xfs_rmap_map_extent(mp, dfops, ip, whichfork, got); } int -- 2.47.2