• Omar Sandoval's avatar
    xfs: limit maxlen based on available space in xfs_rtallocate_extent_near() · ec5857bf
    Omar Sandoval authored
    xfs_rtallocate_extent_near() calls xfs_rtallocate_extent_block() with
    the minlen and maxlen that were passed to it.
    xfs_rtallocate_extent_block() then scans the bitmap block looking for a
    free range of size maxlen. If there is none, it has to scan the whole
    bitmap block before returning the largest range of at least size minlen.
    For a fragmented realtime device and a large allocation request, it's
    almost certain that this will have to search the whole bitmap block,
    leading to high CPU usage.
    
    However, the realtime summary tells us the maximum size available in the
    bitmap block. We can limit the search in xfs_rtallocate_extent_block()
    to that size and often stop before scanning the whole bitmap block.
    Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    ec5857bf
xfs_rtalloc.c 37.8 KB