]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: treat idx as a cursor in xfs_bmap_add_extent_hole_delay
authorChristoph Hellwig <hch@lst.de>
Fri, 17 Nov 2017 04:11:34 +0000 (22:11 -0600)
committerEric Sandeen <sandeen@redhat.com>
Fri, 17 Nov 2017 04:11:34 +0000 (22:11 -0600)
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 <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_bmap.c

index 6999bdb870939f0300b1d31bcd8519cf44155570..fb0e6399632769237daaf2d16320a86cc6829165 100644 (file)
@@ -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;