• Neil Brown's avatar
    [PATCH] md 22 of 22 - Generalise md sync threads · 86711d5e
    Neil Brown authored
    Previously each raid personality (Well, 1 and 5) started their
    own thread to do resync, but md.c had a single common thread to do
    reconstruct.  Apart from being untidy, this means that you cannot
    have two arrays reconstructing at the same time, though you can have
    to array resyncing at the same time..
    
    This patch changes the personalities so they don't start the resync,
    but just leave a flag to say that it is needed.
    The common thread (mdrecoveryd) now just monitors things and starts a
    separate per-array thread whenever resync or recovery (or both) is
    needed.
    When the recovery finishes, mdrecoveryd will be woken up to re-lock
    the device and activate the spares or whatever.
    
    raid1 needs to know when resync/recovery starts and ends so it can
    allocate and release resources.
    It allocated when a resync request for stripe 0 is received.
    Previously it deallocated for resync in it's own thread, and
    deallocated for recovery when the spare is made active or inactive
    (depending on success).
    
    As raid1 doesn't own a thread anymore this needed to change.  So to
    match the "alloc on 0", the md_do_resync now calls sync_request one
    last time asking to sync one block past the end.  This is a signal to
    release any resources.
    86711d5e
md.h 2.78 KB