• Filipe Manana's avatar
    btrfs: reschedule when updating chunk maps at the end of a device replace · b79f1c2c
    Filipe Manana authored
    
    
    At the end of a device replace we must go over all the chunk maps and
    update their stripes to point to the target device instead of the source
    device. We iterate over the chunk maps while holding a write lock and
    we never reschedule, which can result in monopolizing a CPU for too long
    and blocking readers for too long (it's a rw lock, non-blocking).
    
    So improve on this by rescheduling if necessary. This is safe because at
    this point we are holding the chunk mutex, which means no new chunks can
    be allocated and therefore we don't risk missing a new chunk map that
    covers a range behind the last one we processed before rescheduling.
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    b79f1c2c
dev-replace.c 38.1 KB