summaryrefslogtreecommitdiff
path: root/libbcachefs/compress.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-06-03 16:21:35 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2020-06-03 19:56:33 -0400
commit1952c0790c74e4e81d7066a19aabc5c55a13f10f (patch)
tree501fa5db6a5f1fd3b2412a2660e995c74ebf0bba /libbcachefs/compress.c
parent90d54b388666b258c97be6a4e632824d136356c4 (diff)
Update bcachefs sources to c9b4a210f9 fixup! bcachefs: Fixes for going RO
Diffstat (limited to 'libbcachefs/compress.c')
-rw-r--r--libbcachefs/compress.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libbcachefs/compress.c b/libbcachefs/compress.c
index c56938f2..3d75527d 100644
--- a/libbcachefs/compress.c
+++ b/libbcachefs/compress.c
@@ -7,6 +7,7 @@
#include "super-io.h"
#include <linux/lz4.h>
+#include <linux/sched/mm.h>
#include <linux/zlib.h>
#include <linux/zstd.h>
@@ -63,7 +64,7 @@ static struct bbuf __bio_map_or_bounce(struct bch_fs *c, struct bio *bio,
struct bbuf ret;
struct bio_vec bv;
struct bvec_iter iter;
- unsigned nr_pages = 0;
+ unsigned nr_pages = 0, flags;
struct page *stack_pages[16];
struct page **pages = NULL;
void *data;
@@ -103,7 +104,10 @@ static struct bbuf __bio_map_or_bounce(struct bch_fs *c, struct bio *bio,
__bio_for_each_segment(bv, bio, iter, start)
pages[nr_pages++] = bv.bv_page;
+ flags = memalloc_nofs_save();
data = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL);
+ memalloc_nofs_restore(flags);
+
if (pages != stack_pages)
kfree(pages);
@@ -603,7 +607,7 @@ have_compressed:
}
if (!mempool_initialized(&c->decompress_workspace)) {
- ret = mempool_init_kmalloc_pool(
+ ret = mempool_init_kvpmalloc_pool(
&c->decompress_workspace,
1, decompress_workspace_size);
if (ret)