Commit 41d196f4 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: treat idx as a cursor in xfs_bmap_add_extent_hole_delay

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 0d045540
...@@ -2584,7 +2584,6 @@ xfs_bmap_add_extent_hole_delay( ...@@ -2584,7 +2584,6 @@ xfs_bmap_add_extent_hole_delay(
* on the left and on the right. * on the left and on the right.
* Merge all three into a single extent record. * Merge all three into a single extent record.
*/ */
--*idx;
temp = left.br_blockcount + new->br_blockcount + temp = left.br_blockcount + new->br_blockcount +
right.br_blockcount; right.br_blockcount;
...@@ -2595,9 +2594,10 @@ xfs_bmap_add_extent_hole_delay( ...@@ -2595,9 +2594,10 @@ xfs_bmap_add_extent_hole_delay(
oldlen); oldlen);
left.br_startblock = nullstartblock(newlen); left.br_startblock = nullstartblock(newlen);
left.br_blockcount = temp; 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; break;
case BMAP_LEFT_CONTIG: case BMAP_LEFT_CONTIG:
...@@ -2606,7 +2606,6 @@ xfs_bmap_add_extent_hole_delay( ...@@ -2606,7 +2606,6 @@ xfs_bmap_add_extent_hole_delay(
* on the left. * on the left.
* Merge the new allocation with the left neighbor. * Merge the new allocation with the left neighbor.
*/ */
--*idx;
temp = left.br_blockcount + new->br_blockcount; temp = left.br_blockcount + new->br_blockcount;
oldlen = startblockval(left.br_startblock) + oldlen = startblockval(left.br_startblock) +
...@@ -2615,6 +2614,8 @@ xfs_bmap_add_extent_hole_delay( ...@@ -2615,6 +2614,8 @@ xfs_bmap_add_extent_hole_delay(
oldlen); oldlen);
left.br_blockcount = temp; left.br_blockcount = temp;
left.br_startblock = nullstartblock(newlen); left.br_startblock = nullstartblock(newlen);
--*idx;
xfs_iext_update_extent(ip, state, *idx, &left); xfs_iext_update_extent(ip, state, *idx, &left);
break; break;
......
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