Commit 11f75b3b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: update got in xfs_bmap_shift_update_extent

This way the caller gets the proper updated extent returned in got.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent bf806280
...@@ -5591,35 +5591,33 @@ xfs_bmap_shift_update_extent( ...@@ -5591,35 +5591,33 @@ xfs_bmap_shift_update_extent(
xfs_fileoff_t startoff) xfs_fileoff_t startoff)
{ {
struct xfs_mount *mp = ip->i_mount; struct xfs_mount *mp = ip->i_mount;
struct xfs_bmbt_irec new; struct xfs_bmbt_irec prev = *got;
int error, i; int error, i;
*logflags |= XFS_ILOG_CORE; *logflags |= XFS_ILOG_CORE;
new = *got; got->br_startoff = startoff;
new.br_startoff = startoff;
if (cur) { if (cur) {
error = xfs_bmbt_lookup_eq(cur, got, &i); error = xfs_bmbt_lookup_eq(cur, &prev, &i);
if (error) if (error)
return error; return error;
XFS_WANT_CORRUPTED_RETURN(mp, i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
error = xfs_bmbt_update(cur, &new); error = xfs_bmbt_update(cur, got);
if (error) if (error)
return error; return error;
} else { } else {
*logflags |= XFS_ILOG_DEXT; *logflags |= XFS_ILOG_DEXT;
} }
xfs_iext_update_extent(ip, xfs_bmap_fork_to_state(whichfork), idx, xfs_iext_update_extent(ip, xfs_bmap_fork_to_state(whichfork), idx, got);
&new);
/* update reverse mapping */ /* 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) if (error)
return error; return error;
return xfs_rmap_map_extent(mp, dfops, ip, whichfork, &new); return xfs_rmap_map_extent(mp, dfops, ip, whichfork, got);
} }
int int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment