diff options
author | Kent Overstreet <kmo@daterainc.com> | 2014-01-17 03:04:18 +0400 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-02-26 06:41:11 +0400 |
commit | 1b4eaf3d3809a658c85911e92d9ff64086931efa (patch) | |
tree | da491dc55af651888db6390f9a495f0c848f43c9 /drivers/md/bcache | |
parent | 85cbe1f88cb189322e3e4ef98816c19ab12161ea (diff) | |
download | linux-1b4eaf3d3809a658c85911e92d9ff64086931efa.tar.xz |
bcache: Fix flash_dev_cache_miss() for real this time
The code was using sectors to count the number of sectors it was zeroing... but
then it passed it to bio_advance()... after it had been set to 0. Amusing...
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache')
-rw-r--r-- | drivers/md/bcache/request.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 5d5d031cf381..fc14ba3f6d05 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -1203,22 +1203,13 @@ void bch_cached_dev_request_init(struct cached_dev *dc) static int flash_dev_cache_miss(struct btree *b, struct search *s, struct bio *bio, unsigned sectors) { - struct bio_vec bv; - struct bvec_iter iter; - - /* Zero fill bio */ - - bio_for_each_segment(bv, bio, iter) { - unsigned j = min(bv.bv_len >> 9, sectors); - - void *p = kmap(bv.bv_page); - memset(p + bv.bv_offset, 0, j << 9); - kunmap(bv.bv_page); + unsigned bytes = min(sectors, bio_sectors(bio)) << 9; - sectors -= j; - } + swap(bio->bi_iter.bi_size, bytes); + zero_fill_bio(bio); + swap(bio->bi_iter.bi_size, bytes); - bio_advance(bio, min(sectors << 9, bio->bi_iter.bi_size)); + bio_advance(bio, bytes); if (!bio->bi_iter.bi_size) return MAP_DONE; |