[PATCH 3/3] bcache: Fix the bug about cal nr_stripes of backed device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <majianpeng@xxxxxxxxx>
---
 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
ÿôèº{.nÇ+?·?®?­?+%?Ëÿ±éݶ¥?wÿº{.nÇ+?·¥?{±ý·rÿ?{ayºÊ?Ú?ë,j­¢f£¢·h??ï?êÿ?êçz_è®(­é???Ý¢j"?ú¶m§ÿÿ¾«þG«?éÿ¢¸??¨è­Ú&£ø§~?á





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux