From ee2bb3f58521f7e661f6234485dae75d69cd40c9 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 16 Nov 2017 22:11:34 -0600 Subject: [PATCH] xfs: treat idx as a cursor in xfs_bmap_add_extent_hole_delay Source kernel commit: 41d196f439509fd8b09364ca1ba48194cccc6d6e 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 --- libxfs/xfs_bmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 6999bdb87..fb0e63996 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -2575,7 +2575,6 @@ xfs_bmap_add_extent_hole_delay( * on the left and on the right. * Merge all three into a single extent record. */ - --*idx; temp = left.br_blockcount + new->br_blockcount + right.br_blockcount; @@ -2586,9 +2585,10 @@ xfs_bmap_add_extent_hole_delay( oldlen); left.br_startblock = nullstartblock(newlen); left.br_blockcount = temp; - xfs_iext_update_extent(ip, state, *idx, &left); - xfs_iext_remove(ip, *idx + 1, 1, state); + xfs_iext_remove(ip, *idx, 1, state); + --*idx; + xfs_iext_update_extent(ip, state, *idx, &left); break; case BMAP_LEFT_CONTIG: @@ -2597,7 +2597,6 @@ xfs_bmap_add_extent_hole_delay( * on the left. * Merge the new allocation with the left neighbor. */ - --*idx; temp = left.br_blockcount + new->br_blockcount; oldlen = startblockval(left.br_startblock) + @@ -2606,6 +2605,8 @@ xfs_bmap_add_extent_hole_delay( oldlen); left.br_blockcount = temp; left.br_startblock = nullstartblock(newlen); + + --*idx; xfs_iext_update_extent(ip, state, *idx, &left); break; -- 2.47.2