• Dave Chinner's avatar
    xfs: double link the unlinked inode list · 2fd26cc0
    Dave Chinner authored
    Now we have forwards traversal via the incore inode in place, we now
    need to add back pointers to the incore inode to entirely replace
    the back reference cache. We use the same lookup semantics and
    constraints as for the forwards pointer lookups during unlinks, and
    so we can look up any inode in the unlinked list directly and update
    the list pointers, forwards or backwards, at any time.
    
    The only wrinkle in converting the unlinked list manipulations to
    use in-core previous pointers is that log recovery doesn't have the
    incore inode state built up so it can't just read in an inode and
    release it to finish off the unlink. Hence we need to modify the
    traversal in recovery to read one inode ahead before we
    release the inode at the head of the list. This populates the
    next->prev relationship sufficient to be able to replay the unlinked
    list and hence greatly simplify the runtime code.
    
    This recovery algorithm also requires that we actually remove inodes
    from the unlinked list one at a time as background inode
    inactivation will result in unlinked list removal racing with the
    building of the in-memory unlinked list state. We could serialise
    this by holding the AGI buffer lock when constructing the in memory
    state, but all that does is lockstep background processing with list
    building. It is much simpler to flush the inodegc immediately after
    releasing the inode so that it is unlinked immediately and there is
    no races present at all.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    2fd26cc0
xfs_ag.c 25.9 KB