diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-07-03 19:27:42 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:23 -0400 |
commit | 885678f68dd1bf9638087ae8b22051b464f5ec05 (patch) | |
tree | 50f741fa071215136b5bb395b5ffe3b4249f12e4 /fs/bcachefs/compress.c | |
parent | 738540f7fcdd619fe3adb8a27116f0f4371bf711 (diff) | |
download | lwn-885678f68dd1bf9638087ae8b22051b464f5ec05.tar.gz lwn-885678f68dd1bf9638087ae8b22051b464f5ec05.zip |
bcachefs: Kill direct access to bi_io_vec
Switch to always using bio_add_page(), which merges contiguous pages now
that we have multipage bvecs.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
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)); |