• Zhao Lei's avatar
    btrfs: Use unified stripe_page's index calculation · b7178a5f
    Zhao Lei authored
    We are using different index calculation method for stripe_page in
    current code:
    1: (rbio->stripe_len / PAGE_CACHE_SIZE) * stripe_index + page_index
    2: DIV_ROUND_UP(rbio->stripe_len, PAGE_CACHE_SIZE) * stripe_index + page_index
    3: DIV_ROUND_UP(rbio->stripe_len * stripe_index, PAGE_CACHE_SIZE) + page_index
    ...
    
    They can get same result when stripe_len align to PAGE_CACHE_SIZE,
    this is why current code can work, intruduce and use a common function
    for calculation is a better choose.
    Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    b7178a5f
raid56.c 66 KB