]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Use unified stripe_page's index calculation
authorZhao Lei <zhaolei@cn.fujitsu.com>
Tue, 3 Mar 2015 12:38:46 +0000 (20:38 +0800)
committerChris Mason <clm@fb.com>
Wed, 20 Jan 2016 15:22:16 +0000 (07:22 -0800)
commit70fb27b39fe7ac384e3e2726d6faa9e8a29da18c
tree2791d81ab923fd046de7b8f944714b7079c72d97
parente86695ccc843f06dbf728d3e266e8b271537f7ea
btrfs: Use unified stripe_page's index calculation

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: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/raid56.c