RFC btrfs: Convert zlib.c to use kmap_local_page()
Get series with b4
b4 am [email protected]Versions newest first
- v2 RFC Latest3 patches 10 repliesIn review
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | btrfs: Convert zlib_decompress_bio() to use kmap_local_page()fs/ | +5 | 2 replies | |
| 2/3 | btrfs: Use kmap_local_page() on "out_page" in zlib_compress_pages()fs/ | +11 | 2 replies | |
| 3/3 | btrfs: Use kmap_local_page() on "in_page" in zlib_compress_pages()fs/ | +53 | 6 replies |
Reviews trailers per patch
2 of 3 patches have a Reviewed-by or Acked-by.
| Patch | Qu Wenruo |
|---|---|
| 1/3 | R-b |
| 2/3 | R-b |
| 3/3 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [RFC PATCH v2 0/3] btrfs: Convert zlib.c to use 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 zlib.c because in this file the mappings are per thread and are not visible in other contexts.
This is an RFC because patch 3/3 uses an horrid hack. I'm using an array based stack which tracks local mappings / un-mappings. I understand that it is not the better solution, but it works and it is easy to implement :)
I've decided to decompose RFC v1 into a series of three patches in order to make clear that I encountered problems with conversions in patch 3/3. I'm pretty sure that people who are familiar with these functions could refactor this code and provide much more elegant and efficient solutions.
Since this code currently uses kmap() / kunmap(), I think that the functions I'm converting had been designed without taking into account the rules of ordering of nesting local mappings / un-mappings.
I've been trying to refactor this code but it is something beyond my current level of knowledge and skills...
Can anyone please provide any better suited solutions for patch 3/3?
Tested with xfstests on QEMU + KVM 32 bits VM with 4GB of RAM and HIGHMEM64G enabled. Each patch of this series passes 26/26 tests of group "compress".
tweed32:/usr/lib/xfstests # ./check -g compress
FSTYP -- btrfs PLATFORM -- Linux/i686 tweed32 5.19.0-rc2-vanilla-debug+ #45 SMP PREEMPT_DYNAMIC Fri Jun 17 11:14:11 CEST 2022 MKFS_OPTIONS -- /dev/loop1
MOUNT_OPTIONS -- /dev/loop1 /mnt/scratch
btrfs/024 2s ... 3s btrfs/026 5s ... 5s btrfs/037 3s ... 3s btrfs/038 3s ... 2s btrfs/041 3s ... 3s btrfs/062 41s ... 41s btrfs/063 22s ... 23s btrfs/067 39s ... 40s btrfs/068 14s ... 14s btrfs/070 [not run] btrfs and this test needs 5 or more disks in SCRATCH_DEV_POOL btrfs/071 [not run] btrfs and this test needs 5 or more disks in SCRATCH_DEV_POOL btrfs/072 39s ... 41s btrfs/073 20s ... 20s btrfs/074 41s ... 41s btrfs/076 3s ... 3s btrfs/103 3s ... 3s btrfs/106 3s ... 3s btrfs/109 3s ... 3s btrfs/113 3s ... 3s btrfs/138 53s ... 54s btrfs/149 3s ... 3s btrfs/183 3s ... 2s btrfs/205 4s ... 3s btrfs/234 4s ... 4s btrfs/246 2s ... 3s btrfs/251 3s ... 2s
Ran: btrfs/024 btrfs/026 btrfs/037 btrfs/038 btrfs/041 btrfs/062 btrfs/063 btrfs/067 btrfs/068 btrfs/070 btrfs/071 btrfs/072 btrfs/073 btrfs/074 btrfs/076 btrfs/103 btrfs/106 btrfs/109 btrfs/113 btrfs/138 btrfs/149 btrfs/183 btrfs/205 btrfs/234 btrfs/246 btrfs/251 Not run: btrfs/070 btrfs/071
Passed all 26 tests
Fabio M. De Francesco (3):
btrfs: Convert zlib_decompress_bio() to use kmap_local_page()
btrfs: Use kmap_local_page() on "out_page" in zlib_compress_pages()
btrfs: Use kmap_local_page() on "in_page" in zlib_compress_pages()
fs/btrfs/zlib.c | 91 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 24 deletions(-)
Signature · 1 line
2.36.1