xfs: don't rely on extent indices in xfs_bmap_insert_extents
authorChristoph Hellwig <hch@lst.de>
Thu, 19 Oct 2017 18:08:52 +0000 (11:08 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 26 Oct 2017 22:38:28 +0000 (15:38 -0700)
commit5936dc543cfd27de74cd34fdc928b5115cec53d1
tree2e8bc3ec9c73aecf42a36d0ed478567449aa58c4
parent40591bdbccc47661050d98200ab65e77fa2324bd
xfs: don't rely on extent indices in xfs_bmap_insert_extents

Rewrite xfs_bmap_insert_extents so that we don't rely on extent indices
except for iterating over them.  Not being able to iterate to the previous
extent or finding the extent that stop_fsb is in are sufficient exit
conditions, and we don't need to do any extent count games given that:

  a) we already flushed all delalloc extents past our start offset
     before doing the operation
  b) xfs_iext_count() includes delalloc extents anyway

Signed-off-by: Christoph Hellwig <hch@lst.de>
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