• Darrick J. Wong's avatar
    xfs: measure all contiguous previous extents for prealloc size · f0322c7c
    Darrick J. Wong authored
    When we're estimating a new speculative preallocation length for an
    extending write, we should walk backwards through the extent list to
    determine the number of number of blocks that are physically and
    logically contiguous with the write offset, and use that as an input to
    the preallocation size computation.
    
    This way, preallocation length is truly measured by the effectiveness of
    the allocator in giving us contiguous allocations without being
    influenced by the state of a given extent.  This fixes both the problem
    where ZERO_RANGE within an EOF can reduce preallocation, and prevents
    the unnecessary shrinkage of preallocation when delalloc extents are
    turned into unwritten extents.
    
    This was found as a regression in xfs/014 after changing delalloc writes
    to create unwritten extents during writeback.
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
    f0322c7c
xfs_iomap.c 35 KB