btrfs: zlib: replace kmap() with kmap_local_page() in zlib_compress_pages()
authorFabio M. De Francesco <fmdefrancesco@gmail.com>
Mon, 27 Jun 2022 16:33:05 +0000 (18:33 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Jul 2022 15:45:40 +0000 (17:45 +0200)
commit718e58551aecf7a63aa643ec0668a0374eee9de0
tree65f8a7c110f65b0c31675328cab7e3c7f6556f27
parentebd23482efa3d077a9461af29a093bdce3d3a2b8
btrfs: zlib: replace kmap() with kmap_local_page() in zlib_compress_pages()

The use of kmap() is being deprecated in favor of kmap_local_page(). With
kmap_local_page(), the mapping is per thread, CPU local and not globally
visible.

Therefore, use kmap_local_page() / kunmap_local() in zlib_compress_pages()
because in this function the mappings are per thread and are not visible
in other contexts. Furthermore, drop the mappings of "out_page" which is
allocated within zlib_compress_pages() with alloc_page(GFP_NOFS) and use
page_address().

Tested with xfstests on a QEMU + KVM 32-bits VM with 4GB of RAM booting
a kernel with HIGHMEM64G enabled. This patch passes 26/26 tests of group
"compress".

CC: Qu Wenruo <wqu@suse.com>
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/zlib.c