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(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 21f77c1..6394dd6 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -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 || -- 1.7.10.4
