diff options
Diffstat (limited to 'fs/bcachefs/compress.c')
-rw-r--r-- | fs/bcachefs/compress.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c index 6b5b61f10fcb..3e91fa53985a 100644 --- a/fs/bcachefs/compress.c +++ b/fs/bcachefs/compress.c @@ -244,7 +244,16 @@ 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: */ - bch2_bio_alloc_more_pages_pool(c, bio, crc->live_size << 9); + 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); + } + } memcpy_to_bio(bio, bio->bi_iter, data.b + (crc->offset << 9)); |