Skip to content
  • NeilBrown's avatar
    md: occasionally checkpoint drive recovery to reduce duplicate effort after a crash · 97e4f42d
    NeilBrown authored
    
    
    Version 1.x metadata has the ability to record the status of a
    partially completed drive recovery.
    However we only update that record on a clean shutdown.
    It would be nice to update it on unclean shutdowns too, particularly
    when using a bitmap that removes much to the 'sync' effort after an
    unclean shutdown.
    
    One complication with checkpointing recovery is that we only know
    where we are up to in terms of IO requests started, not which ones
    have completed.  And we need to know what has completed to record
    how much is recovered.  So occasionally pause the recovery until all
    submitted requests are completed, then update the record of where
    we are up to.
    
    When we have a bitmap, we already do that pause occasionally to keep
    the bitmap up-to-date.  So enhance that code to record the recovery
    offset and schedule a superblock update.
    And when there is no bitmap, just pause 16 times during the resync to
    do a checkpoint.
    '16' is a fairly arbitrary number.  But we don't really have any good
    way to judge how often is acceptable, and it seems like a reasonable
    number for now.
    
    
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    97e4f42d