• Darrick J. Wong's avatar
    xfs: iscan batching should handle unallocated inodes too · 82334a79
    Darrick J. Wong authored
    The inode scanner tries to reduce contention on the AGI header buffer
    lock by grabbing references to consecutive allocated inodes.  Batching
    stops as soon as we encounter an unallocated inode.  This is unfortunate
    because in the worst case performance collapses to the old "one at a
    time" behavior if every other inode is free.
    
    This is correct behavior, but we could do better.  Unallocated inodes by
    definition have nothing to scan, which means the iscan can ignore them
    as long as someone ensures that the scan data will reflect another
    thread allocating the inode and adding interesting metadata to that
    inode.  That mechanism is, of course, the live update hooks.
    
    Therefore, extend the batching mechanism to track unallocated inodes
    adjacent to the scan cursor.  The _want_live_update predicate can tell
    the caller's live update hook to incorporate all live updates to what
    the scanner thinks is an unallocated inode if (after dropping the AGI)
    some other thread allocates one of those inodes and begins using it.
    
    Note that we cannot just copy the ir_free bitmap into the scan cursor
    because the batching stops if iget says the inode is in an intermediate
    state (e.g. on the inactivation list) and cannot be igrabbed.
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    82334a79
iscan.h 2.39 KB