Re: [PATCH 2/4] fs/btrfs: Convert raid5/6 kmaps to kmap_local_page()

From: David Sterba
Date: Fri Mar 12 2021 - 14:29:37 EST


On Tue, Feb 16, 2021 at 06:48:24PM -0800, ira.weiny@xxxxxxxxx wrote:
> From: Ira Weiny <ira.weiny@xxxxxxxxx>
>
> These kmaps are thread local and don't need to be atomic. So they can use
> the more efficient kmap_local_page(). However, the mapping of pages in
> the stripes and the additional parity and qstripe pages are a bit
> trickier because the unmapping must occur in the opposite order from the
> mapping. Furthermore, the pointer array in __raid_recover_end_io() may
> get reordered.
>
> Convert these calls to kmap_local_page() taking care to reverse the
> unmappings of any page arrays as well as being careful with the mappings
> of any special pages such as the parity and qstripe pages.

Though there's one more allocation for the additional array, I don't see
a simpler way to avoid it and track the array reordering at a lower
memory cost. At least it's not in a performance critical code and the
array size is reasonably small.