]> xenbits.xensource.com Git - arm/linux.git/commitdiff
xfs: treat idx as a cursor in xfs_bmap_add_extent_hole_real
authorChristoph Hellwig <hch@lst.de>
Fri, 3 Nov 2017 17:34:40 +0000 (10:34 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 6 Nov 2017 19:53:39 +0000 (11:53 -0800)
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>
fs/xfs/libxfs/xfs_bmap.c

index e2d8cbd054fe025d2ad5237cfe9f87cab65d4c20..117083b1d1ae895189e741f3d17920a7564df2ef 100644 (file)
@@ -2742,11 +2742,11 @@ xfs_bmap_add_extent_hole_real(
                 * left and on the right.
                 * Merge all three into a single extent record.
                 */
-               --*idx;
                left.br_blockcount += new->br_blockcount + right.br_blockcount;
-               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);
 
                XFS_IFORK_NEXT_SET(ip, whichfork,
                        XFS_IFORK_NEXTENTS(ip, whichfork) - 1);
@@ -2778,10 +2778,10 @@ xfs_bmap_add_extent_hole_real(
                 * on the left.
                 * Merge the new allocation with the left neighbor.
                 */
-               --*idx;
                old = left;
-
                left.br_blockcount += new->br_blockcount;
+
+               --*idx;
                xfs_iext_update_extent(ip, state, *idx, &left);
 
                if (cur == NULL) {