btrfs: zstd: replace kmap() with kmap_local_page()
authorFabio M. De Francesco <fmdefrancesco@gmail.com>
Wed, 6 Jul 2022 11:15:20 +0000 (13:15 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Jul 2022 15:45:40 +0000 (17:45 +0200)
commitebd23482efa3d077a9461af29a093bdce3d3a2b8
tree263fcfa3621c6787134d9811a68f656cac2f43c8
parent39ade048a32ea653b94dcfbf816b0b13a6be8a33
btrfs: zstd: replace kmap() with kmap_local_page()

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 zstd.c because in this
file the mappings are per thread and are not visible in other contexts. In
the meanwhile use plain page_address() on output pages allocated with
the GFP_NOFS flag instead of calling kmap*() on them (since they are
always allocated from ZONE_NORMAL).

Tested with xfstests on QEMU + KVM 32 bits VM with 4GB of RAM, booting a
kernel with HIGHMEM64G enabled.

Suggested-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/zstd.c