• Brian Foster's avatar
    xfs: include an allocfree res for inobt modifications · f03c78f3
    Brian Foster authored
    Analysis of recent reports of log reservation overruns and code
    inspection has uncovered that the reservations associated with inode
    operations may not cover the worst case scenarios. In particular,
    many cases only include one allocfree res. for a particular
    operation even though said operations may also entail AGFL fixups
    and inode btree block allocations in addition to the actual inode
    chunk allocation. This can easily turn into two or three block
    allocations (or frees) per operation.
    
    In theory, the only way to define the worst case reservation is to
    include an allocfree res for each individual allocation in a
    transaction. Since that is impractical (we can perform multiple agfl
    fixups per tx and not every allocation results in a full tree
    operation), we need to find a reasonable compromise that addresses
    the deficiency in practice without blowing out the size of the
    transactions.
    
    Since the inode btrees are not filled by the AGFL, record insertion
    and removal can directly result in block allocations and frees
    depending on the shape of the tree. These allocations and frees
    occur in the same transaction context as the inobt update itself,
    but are separate from the allocation/free that might be required for
    an inode chunk. Therefore, it makes sense to assume that an [f]inobt
    insert/remove can directly result in one or more block allocations
    on behalf of the tree.
    
    Refactor the inode transaction reservations to include one allocfree
    res. per inode btree modification to cover allocations required by
    the tree itself. This separates the reservation required to allocate
    the inode chunk from the reservation required for inobt record
    insertion/removal. Apply the same logic to the finobt. This results
    in killing off the finobt modify condition because we no longer
    assume that the broader transaction reservation will cover finobt
    block allocations and finobt shape changes can occur in either of
    the inobt allocation or modify situations.
    Suggested-by: default avatarDave Chinner <david@fromorbit.com>
    Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
    Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    f03c78f3
xfs_trans_resv.c 29.2 KB