• Brian Foster's avatar
    xfs: split indlen reservations fairly when under reserved · 75d65361
    Brian Foster authored
    Certain workoads that punch holes into speculative preallocation can
    cause delalloc indirect reservation splits when the delalloc extent is
    split in two. If further splits occur, an already short-handed extent
    can be split into two in a manner that leaves zero indirect blocks for
    one of the two new extents. This occurs because the shortage is large
    enough that the xfs_bmap_split_indlen() algorithm completely drains the
    requested indlen of one of the extents before it honors the existing
    reservation.
    
    This ultimately results in a warning from xfs_bmap_del_extent(). This
    has been observed during file copies of large, sparse files using 'cp
    --sparse=always.'
    
    To avoid this problem, update xfs_bmap_split_indlen() to explicitly
    apply the reservation shortage fairly between both extents. This smooths
    out the overall indlen shortage and defers the situation where we end up
    with a delalloc extent with zero indlen reservation to extreme
    circumstances.
    Reported-by: default avatarPatrick Dung <mpatdung@gmail.com>
    Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    75d65361
xfs_bmap.c 186 KB