aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/request.c
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2014-01-16 18:04:18 -0500
committerKent Overstreet <kmo@daterainc.com>2014-02-25 21:41:11 -0500
commit1b4eaf3d3809a658c85911e92d9ff64086931efa (patch)
treeda491dc55af651888db6390f9a495f0c848f43c9 /drivers/md/bcache/request.c
parent85cbe1f88cb189322e3e4ef98816c19ab12161ea (diff)
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/request.c')
-rw-r--r--drivers/md/bcache/request.c19
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)
1203static int flash_dev_cache_miss(struct btree *b, struct search *s, 1203static int flash_dev_cache_miss(struct btree *b, struct search *s,
1204 struct bio *bio, unsigned sectors) 1204 struct bio *bio, unsigned sectors)
1205{ 1205{
1206 struct bio_vec bv; 1206 unsigned bytes = min(sectors, bio_sectors(bio)) << 9;
1207 struct bvec_iter iter;
1208
1209 /* Zero fill bio */
1210
1211 bio_for_each_segment(bv, bio, iter) {
1212 unsigned j = min(bv.bv_len >> 9, sectors);
1213
1214 void *p = kmap(bv.bv_page);
1215 memset(p + bv.bv_offset, 0, j << 9);
1216 kunmap(bv.bv_page);
1217 1207
1218 sectors -= j; 1208 swap(bio->bi_iter.bi_size, bytes);
1219 } 1209 zero_fill_bio(bio);
1210 swap(bio->bi_iter.bi_size, bytes);
1220 1211
1221 bio_advance(bio, min(sectors << 9, bio->bi_iter.bi_size)); 1212 bio_advance(bio, bytes);
1222 1213
1223 if (!bio->bi_iter.bi_size) 1214 if (!bio->bi_iter.bi_size)
1224 return MAP_DONE; 1215 return MAP_DONE;