diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-04 02:34:41 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2017-01-18 21:40:31 -0900 |
commit | 8956db0dc6e2ba979b7a9cb55a50dd7a2302f3db (patch) | |
tree | 2bbd211c1ec3c03b80939a620891bcb6b67c1e1d | |
parent | 5825611f5280ef1cdd3874c4601697f07d20d46a (diff) |
bcache: fix tiering + compression
-rw-r--r-- | drivers/md/bcache/io.c | 6 | ||||
-rw-r--r-- | drivers/md/bcache/io_types.h | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index c1ca30f7ca2a..f373d95744da 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c @@ -566,7 +566,10 @@ static void __bch_write(struct closure *cl) k = op->insert_keys.top; bkey_extent_init(k); k->k.p = op->pos; - bch_key_resize(&k->k, bio_sectors(bio)); + bch_key_resize(&k->k, + (op->flags & BCH_WRITE_DATA_COMPRESSED) + ? op->size + : bio_sectors(bio)); b = bch_alloc_sectors_start(op->c, op->wp, bkey_i_to_extent(k), op->nr_replicas, @@ -1188,6 +1191,7 @@ void bch_read_extent_iter(struct cache_set *c, struct bch_read_bio *orig, if (rbio->crc.compression_type) { promote_op->write.op.flags |= BCH_WRITE_DATA_COMPRESSED; promote_op->write.op.crc = rbio->crc; + promote_op->write.op.size = k.k->size; } else if (read_full) { /* * Adjust bio to correspond to _live_ portion of @k - diff --git a/drivers/md/bcache/io_types.h b/drivers/md/bcache/io_types.h index 4454c70799af..927106f1020f 100644 --- a/drivers/md/bcache/io_types.h +++ b/drivers/md/bcache/io_types.h @@ -102,7 +102,9 @@ struct bch_write_op { struct bpos pos; unsigned version; + /* For BCH_WRITE_DATA_COMPRESSED: */ struct bch_extent_crc64 crc; + unsigned size; struct disk_reservation res; |