bcache: Fix the bug about cal nr_stripes of backed device
PATCH 3/3 bcache: Fix the bug about cal nr_stripes of backed device
In func bcache_device_init(),it use this expression to cal nr_stripes:
"d->nr_stripes = DIV_ROUND_UP_ULL(sectors, d->stripe_size)". But the unit of d->stripe_size is byte,the unit os sectors is sector. So we should replace sectors with "secotrs << 9".
Signed-off-by Jianpeng Ma <[email protected]>
--- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/super.c +1 -1
@@ -769,7 +769,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,if (!d->stripe_size) d->stripe_size =min_t (unsigned,1 <<31 , q->limits.io_opt); - d->nr_stripes =DIV_ROUND_UP_ULL (sectors, d->stripe_size); + d->nr_stripes =DIV_ROUND_UP_ULL (sectors <<9 , d->stripe_size); if (!d->nr_stripes || d->nr_stripes > INT_MAX ||
Signature · 1 line
1.7.10.4
Quoted 4 lines · majianpeng
In func bcache_device_init(),it use this expression to cal
nr_stripes:
"d->nr_stripes=DIV_ROUND_UP_ULL(sectors, d->stripe_size)". But the unit ofd->stripe_sizeis byte,the unit os sectors is sector. So we should replace sectors with "secotrs << 9".
Nope, d->stripe_size is definitely sectors.