Skip to content
  • NeilBrown's avatar
    md: tidy up status_resync to handle large arrays. · dd71cf6b
    NeilBrown authored
    
    
    Two problems in status_resync.
    1/ It still used Kilobytes as the basic block unit, while most code
       now uses sectors uniformly.
    2/ It doesn't allow for the possibility that max_sectors exceeds
       the range of "unsigned long".
    
    So
     - change "max_blocks" to "max_sectors", and store sector numbers
       in there and in 'resync'
     - Make 'rt' a 'sector_t' so it can temporarily hold the number of
       remaining sectors.
     - use sector_div rather than normal division.
     - change the magic '100' used to preserve precision to '32'.
       + making it a power of 2 makes division easier
       + it doesn't need to be as large as it was chosen when we averaged
         speed over the entire run.  Now we average speed over the last 30
         seconds or so.
    
    Reported-by: default avatar"Mario 'BitKoenig' Holbe" <Mario.Holbe@TU-Ilmenau.DE>
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    dd71cf6b