• A
    raid5-ppl: use resize_stripes() when enabling or disabling ppl · 845b9e22
    Artur Paszkiewicz 提交于
    Use resize_stripes() instead of raid5_reset_stripe_cache() to allocate
    or free sh->ppl_page at runtime for all stripes in the stripe cache.
    raid5_reset_stripe_cache() required suspending the mddev and could
    deadlock because of GFP_KERNEL allocations.
    
    Move the 'newsize' check to check_reshape() to allow reallocating the
    stripes with the same number of disks. Allocate sh->ppl_page in
    alloc_stripe() instead of grow_buffers(). Pass 'struct r5conf *conf' as
    a parameter to alloc_stripe() because it is needed to check whether to
    allocate ppl_page. Add free_stripe() and use it to free stripes rather
    than directly call kmem_cache_free(). Also free sh->ppl_page in
    free_stripe().
    
    Set MD_HAS_PPL at the end of ppl_init_log() instead of explicitly
    setting it in advance and add another parameter to log_init() to allow
    calling ppl_init_log() without the bit set. Don't try to calculate
    partial parity or add a stripe to log if it does not have ppl_page set.
    
    Enabling ppl can now be performed without suspending the mddev, because
    the log won't be used until new stripes are allocated with ppl_page.
    Calling mddev_suspend/resume is still necessary when disabling ppl,
    because we want all stripes to finish before stopping the log, but
    resize_stripes() can be called after mddev_resume() when ppl is no
    longer active.
    Suggested-by: NNeilBrown <neilb@suse.com>
    Signed-off-by: NArtur Paszkiewicz <artur.paszkiewicz@intel.com>
    Signed-off-by: NShaohua Li <shli@fb.com>
    845b9e22
raid5.c 237.4 KB