summaryrefslogtreecommitdiff
path: root/fs/bcachefs/compress.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-07-09 11:16:33 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:23 -0400
commita6f4d5bb249cf6ac44d1a83c72584402b7e5f6ed (patch)
treec42f9f778643aee3098fb1a8f50e075aeb55bf88 /fs/bcachefs/compress.c
parent0fd7263e2e55d43317e85e9f7a4e67de9fa0ec90 (diff)
bcachefs: Fix moving compressed data
bio_uncompress_inplace() used to potentially need to extend the bio to be big enough for the uncompressed data, which has become problematic with multipage bvecs - but, the move extent path actually already allocated the bios to be big enough for the uncompressed data. The promote path needed to be fixed, though. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/compress.c')
-rw-r--r--fs/bcachefs/compress.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c
index 1a51a8c3e95c..d350d917a8d4 100644
--- a/fs/bcachefs/compress.c
+++ b/fs/bcachefs/compress.c
@@ -241,19 +241,10 @@ int bch2_bio_uncompress_inplace(struct bch_fs *c, struct bio *bio,
}
/*
- * might have to free existing pages and retry allocation from mempool -
- * do this _after_ decompressing:
+ * XXX: don't have a good way to assert that the bio was allocated with
+ * enough space, we depend on bch2_move_extent doing the right thing
*/
- if (bio->bi_iter.bi_size < crc->live_size << 9) {
- if (bch2_bio_alloc_pages(bio, (crc->live_size << 9) -
- bio->bi_iter.bi_size,
- GFP_NOFS)) {
- bch2_bio_free_pages_pool(c, bio);
- bio->bi_iter.bi_size = 0;
- bio->bi_vcnt = 0;
- bch2_bio_alloc_pages_pool(c, bio, crc->live_size << 9);
- }
- }
+ bio->bi_iter.bi_size = crc->live_size << 9;
memcpy_to_bio(bio, bio->bi_iter, data.b + (crc->offset << 9));