From: Christoph Hellwig Date: Fri, 17 Nov 2017 04:11:34 +0000 (-0600) Subject: xfs: treat idx as a cursor in xfs_bmap_del_extent_* X-Git-Tag: v4.15.0-rc1~143^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28441228c7a5a2e035e92eaf35588ee1f058bb0d;p=thirdparty%2Fxfsprogs-dev.git xfs: treat idx as a cursor in xfs_bmap_del_extent_* Source kernel commit: 657fcb23362c9e8a72593b3e4755135f003a7a74 Stop poking before and after the index and just increment or decrement it while doing our operations on it to prepare for a new extent list implementation. Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 0dddf0f61..78f482b0d 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -4741,12 +4741,12 @@ xfs_bmap_del_extent_delay( del->br_blockcount); got->br_startblock = nullstartblock((int)got_indlen); - xfs_iext_update_extent(ip, state, *idx, got); new.br_startoff = del_endoff; new.br_state = got->br_state; new.br_startblock = nullstartblock((int)new_indlen); + xfs_iext_update_extent(ip, state, *idx, got); ++*idx; xfs_iext_insert(ip, *idx, 1, &new, state); @@ -4823,13 +4823,13 @@ xfs_bmap_del_extent_cow( * Deleting the middle of the extent. */ got->br_blockcount = del->br_startoff - got->br_startoff; - xfs_iext_update_extent(ip, state, *idx, got); new.br_startoff = del_endoff; new.br_blockcount = got_endoff - del_endoff; new.br_state = got->br_state; new.br_startblock = del->br_startblock + del->br_blockcount; + xfs_iext_update_extent(ip, state, *idx, got); ++*idx; xfs_iext_insert(ip, *idx, 1, &new, state); break; @@ -5045,8 +5045,8 @@ xfs_bmap_del_extent_real( flags |= xfs_ilog_fext(whichfork); XFS_IFORK_NEXT_SET(ip, whichfork, XFS_IFORK_NEXTENTS(ip, whichfork) + 1); - xfs_iext_insert(ip, *idx + 1, 1, &new, state); ++*idx; + xfs_iext_insert(ip, *idx, 1, &new, state); break; }