• Darrick J. Wong's avatar
    xfs: teach the tempfile to set up atomic file content exchanges · 56596d8b
    Darrick J. Wong authored
    Create some new routines to exchange the contents of a temporary file
    created to stage a repair with another ondisk file.  This will be used
    by the realtime summary repair function to commit atomically the new
    rtsummary data, which will be staged in the tempfile.
    
    The rest of XFS coordinates access to the realtime metadata inodes
    solely through the ILOCK.  For repair to hold its exclusive access to
    the realtime summary file, it has to allocate a single large transaction
    and roll it repeatedly throughout the repair while holding the ILOCK.
    In turn, this means that for now there's only a partial file mapping
    exchange implementation for the temporary file because we can only work
    within an existing transaction.
    
    For now, the only tempswap functions needed here are to estimate the
    resource requirements of the exchange, reserve more space/quota to an
    existing transaction, and kick off the actual exchange.  The rest will
    be added in a later patch in preparation for repairing xattrs and
    directories.
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    56596d8b
scrub.c 18.7 KB