summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bcache/io.c6
-rw-r--r--drivers/md/bcache/io_types.h2
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;