diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-08-17 05:13:15 -0400 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2013-11-11 00:55:55 -0500 |
commit | 2d679fc75678551485df62274edaed452becd16d (patch) | |
tree | 5ac694ced25578b0b54893f69d74bbcaa65b0b67 /drivers/md/bcache/writeback.h | |
parent | 77c320eb46e216c17aee5c943949229ccfed6904 (diff) |
bcache: Stripe size isn't necessarily a power of two
Originally I got this right... except that the divides didn't use
do_div(), which broke 32 bit kernels. When I went to fix that, I forgot
that the raid stripe size usually isn't a power of two... doh
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/writeback.h')
-rw-r--r-- | drivers/md/bcache/writeback.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h index c91f61bb95b6..34961888b5a9 100644 --- a/drivers/md/bcache/writeback.h +++ b/drivers/md/bcache/writeback.h | |||
@@ -18,16 +18,18 @@ static inline bool bcache_dev_stripe_dirty(struct bcache_device *d, | |||
18 | uint64_t offset, | 18 | uint64_t offset, |
19 | unsigned nr_sectors) | 19 | unsigned nr_sectors) |
20 | { | 20 | { |
21 | uint64_t stripe = offset >> d->stripe_size_bits; | 21 | uint64_t stripe = offset; |
22 | |||
23 | do_div(stripe, d->stripe_size); | ||
22 | 24 | ||
23 | while (1) { | 25 | while (1) { |
24 | if (atomic_read(d->stripe_sectors_dirty + stripe)) | 26 | if (atomic_read(d->stripe_sectors_dirty + stripe)) |
25 | return true; | 27 | return true; |
26 | 28 | ||
27 | if (nr_sectors <= 1 << d->stripe_size_bits) | 29 | if (nr_sectors <= d->stripe_size) |
28 | return false; | 30 | return false; |
29 | 31 | ||
30 | nr_sectors -= 1 << d->stripe_size_bits; | 32 | nr_sectors -= d->stripe_size; |
31 | stripe++; | 33 | stripe++; |
32 | } | 34 | } |
33 | } | 35 | } |