• Dave Chinner's avatar
    xfs: block reservation too large for minleft allocation · d5753847
    Dave Chinner authored
    When we enter xfs_bmbt_alloc_block() without having first allocated
    a data extent (i.e. tp->t_firstblock == NULLFSBLOCK) because we
    are doing something like unwritten extent conversion, the transaction
    block reservation is used as the minleft value.
    
    This works for operations like unwritten extent conversion, but it
    assumes that the block reservation is only for a BMBT split. THis is
    not always true, and sometimes results in larger than necessary
    minleft values being set. We only actually need enough space for a
    btree split, something we already handle correctly in
    xfs_bmapi_write() via the xfs_bmapi_minleft() calculation.
    
    We should use xfs_bmapi_minleft() in xfs_bmbt_alloc_block() to
    calculate the number of blocks a BMBT split on this inode is going to
    require, not use the transaction block reservation that contains the
    maximum number of blocks this transaction may consume in it...
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarAllison Henderson <allison.henderson@oracle.com>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    d5753847
xfs_bmap_btree.c 17.8 KB