From: majianpeng <majianpeng@gmail.com>
To: kmo <kmo@daterainc.com>
Cc: linux-bcache <linux-bcache@vger.kernel.org>
Subject: [PATCH 3/3] bcache: Fix the bug about cal nr_stripes of backed device
Date: Wed, 8 Jan 2014 19:39:28 +0800 [thread overview]
Message-ID: <201401081939244995495@gmail.com> (raw)
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
next reply other threads:[~2014-01-08 11:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-08 11:39 majianpeng [this message]
2014-01-08 21:37 ` [PATCH 3/3] bcache: Fix the bug about cal nr_stripes of backed device Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201401081939244995495@gmail.com \
--to=majianpeng@gmail.com \
--cc=kmo@daterainc.com \
--cc=linux-bcache@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.