From 8b23a1b622f5535cf9aa614c43af01629c7cbde2 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 21 May 2020 17:23:40 -0400 Subject: [PATCH] bcachefs: Wrap vmap() in memalloc_nofs_save()/restore() vmalloc() and vmap() don't take GFP_NOFS - this should be pushed further up the IO path, but for now just doing the simple fix. Signed-off-by: Kent Overstreet --- fs/bcachefs/compress.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c index c56938f21baa67..46b0add1eb66d7 100644 --- a/fs/bcachefs/compress.c +++ b/fs/bcachefs/compress.c @@ -7,6 +7,7 @@ #include "super-io.h" #include +#include #include #include @@ -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);