summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-04-25 22:47:14 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 21:39:19 -0900
commita3b76d5b38af09034e07dbd036d034b850d959ec (patch)
tree33bb8487736e837878ecdce47bde46765f5b303c
parent1456d0ff4384eff7881e00b88b36c79e0f9892d7 (diff)
bcache: fix orig_sectors in bch_read_extent_iter()
supposed to use the separate bvec_iter that was passed in
-rw-r--r--drivers/md/bcache/io.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index 31e6330dcf67..06da65f2fbb3 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -1750,7 +1750,6 @@ void bch_read_extent_iter(struct cache_set *c, struct bch_read_bio *orig,
{
struct bch_read_bio *rbio;
struct cache_promote_op *promote_op = NULL;
- unsigned orig_sectors = bio_sectors(&orig->bio);
unsigned skip = iter.bi_sector - bkey_start_offset(k.k);
bool bounce = false, split, read_full = false;
@@ -1771,7 +1770,7 @@ void bch_read_extent_iter(struct cache_set *c, struct bch_read_bio *orig,
*/
if (pick->crc.compression_type != BCH_COMPRESSION_NONE ||
(pick->crc.csum_type != BCH_CSUM_NONE &&
- (orig_sectors != pick->crc.uncompressed_size ||
+ (bvec_iter_sectors(iter) != pick->crc.uncompressed_size ||
(flags & BCH_READ_FORCE_BOUNCE)))) {
read_full = true;
bounce = true;
@@ -1780,7 +1779,7 @@ void bch_read_extent_iter(struct cache_set *c, struct bch_read_bio *orig,
if (bounce) {
unsigned sectors = read_full
? (pick->crc.compressed_size ?: k.k->size)
- : orig_sectors;
+ : bvec_iter_sectors(iter);
rbio = container_of(bio_alloc_bioset(GFP_NOIO,
DIV_ROUND_UP(sectors, PAGE_SECTORS),
@@ -1861,7 +1860,7 @@ void bch_read_extent_iter(struct cache_set *c, struct bch_read_bio *orig,
bkey_start_offset(k.k) + skip),
&promote_op->iop.insert_key);
bch_key_resize(&promote_op->iop.insert_key.k,
- orig_sectors);
+ bvec_iter_sectors(iter));
}
__bio_clone_fast(&promote_op->bio.bio.bio, &rbio->bio);