OSDN Git Service

btrfs: switch to kvmalloc and GFP_KERNEL in lzo/zlib alloc_workspace
authorDavid Sterba <dsterba@suse.com>
Wed, 31 May 2017 15:21:15 +0000 (17:21 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2017 16:26:02 +0000 (18:26 +0200)
commit6acafd1eff426ac21dbf70498d8739304c4bf928
treec4633060e4ed7c2069b83aea49a5a429df62ef5f
parent389a6cfc2afb833e65b93ad6d8220ad1a84538a2
btrfs: switch to kvmalloc and GFP_KERNEL in lzo/zlib alloc_workspace

The compression workspace buffers are larger than a page so we use
vmalloc, unconditionally. This is not always necessary as there might be
contiguous memory available.

Let's use the kvmalloc helpers that will try kmalloc first and fallback
to vmalloc. For that they require GFP_KERNEL flags. As we now have the
alloc_workspace calls protected by memalloc_nofs in the critical
contexts, we can safely use GFP_KERNEL.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/lzo.c
fs/btrfs/zlib.c