• B
    xfs: split indlen reservations fairly when under reserved · 75d65361
    Brian Foster 提交于
    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: NPatrick Dung <mpatdung@gmail.com>
    Signed-off-by: NBrian Foster <bfoster@redhat.com>
    Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
    75d65361
xfs_bmap.c 185.5 KB