* [PATCH 3/3] bcache: Fix the bug about cal nr_stripes of backed device
@ 2014-01-08 11:39 majianpeng
2014-01-08 21:37 ` Kent Overstreet
0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2014-01-08 11:39 UTC (permalink / raw)
To: kmo; +Cc: linux-bcache
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@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 3/3] bcache: Fix the bug about cal nr_stripes of backed device
2014-01-08 11:39 [PATCH 3/3] bcache: Fix the bug about cal nr_stripes of backed device majianpeng
@ 2014-01-08 21:37 ` Kent Overstreet
0 siblings, 0 replies; 2+ messages in thread
From: Kent Overstreet @ 2014-01-08 21:37 UTC (permalink / raw)
To: majianpeng; +Cc: linux-bcache
On Wed, Jan 08, 2014 at 07:39:28PM +0800, majianpeng wrote:
> 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".
Nope, d->stripe_size is definitely sectors.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-08 21:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-08 11:39 [PATCH 3/3] bcache: Fix the bug about cal nr_stripes of backed device majianpeng
2014-01-08 21:37 ` Kent Overstreet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).