• Dave Chinner's avatar
    xfs: Add order IDs to log items in CIL · 016a2338
    Dave Chinner authored
    Before we split the ordered CIL up into per cpu lists, we need a
    mechanism to track the order of the items in the CIL. We need to do
    this because there are rules around the order in which related items
    must physically appear in the log even inside a single checkpoint
    transaction.
    
    An example of this is intents - an intent must appear in the log
    before it's intent done record so that log recovery can cancel the
    intent correctly. If we have these two records misordered in the
    CIL, then they will not be recovered correctly by journal replay.
    
    We also will not be able to move items to the tail of
    the CIL list when they are relogged, hence the log items will need
    some mechanism to allow the correct log item order to be recreated
    before we write log items to the hournal.
    
    Hence we need to have a mechanism for recording global order of
    transactions in the log items  so that we can recover that order
    from un-ordered per-cpu lists.
    
    Do this with a simple monotonic increasing commit counter in the CIL
    context. Each log item in the transaction gets stamped with the
    current commit order ID before it is added to the CIL. If the item
    is already in the CIL, leave it where it is instead of moving it to
    the tail of the list and instead sort the list before we start the
    push work.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    016a2338
xfs_trans.h 9.78 KB