xfs: don't look for end of extent further than necessary in xfs_rtallocate_extent_near()
authorOmar Sandoval <osandov@fb.com>
Mon, 16 Oct 2023 17:48:50 +0000 (10:48 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 19 Oct 2023 15:34:33 +0000 (08:34 -0700)
commite0f7422f54b092df7996f21da69824aea496490a
tree2e09ea02d65e8f94d1837f29b30d2e93d92f2c48
parent85fa2c774397b98f5dc65a4ed6ab17c1a15db158
xfs: don't look for end of extent further than necessary in xfs_rtallocate_extent_near()

As explained in the previous commit, xfs_rtallocate_extent_near() looks
for the end of a free extent when searching backwards from the target
bitmap block. Since the previous commit, it searches from the last
bitmap block it checked to the bitmap block containing the start of the
extent.

This may still be more than necessary, since the free extent may not be
that long. We know the maximum size of the free extent from the realtime
summary. Use that to compute how many bitmap blocks we actually need to
check.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_rtalloc.c