diff options
author | Ira Weiny <ira.weiny@intel.com> | 2021-02-16 18:48:23 -0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-04-19 17:25:16 +0200 |
commit | 58c1a35cd52268ae1524b3ff5eac9fa2414e6efc (patch) | |
tree | c7b88700119a7542dba4feba9be3d7475ba48f86 /fs/btrfs/raid56.c | |
parent | cea628008fc8c6c9c7b53902f6659e040f33c790 (diff) | |
download | linux-58c1a35cd52268ae1524b3ff5eac9fa2414e6efc.tar.gz linux-58c1a35cd52268ae1524b3ff5eac9fa2414e6efc.tar.bz2 linux-58c1a35cd52268ae1524b3ff5eac9fa2414e6efc.zip |
btrfs: convert kmap to kmap_local_page, simple cases
Use a simple coccinelle script to help convert the most common
kmap()/kunmap() patterns to kmap_local_page()/kunmap_local().
Note that some kmaps which were caught by this script needed to be
handled by hand because of the strict unmapping order of kunmap_local()
so they are not included in this patch. But this script got us started.
There's another temp variable added for the final length write to the
first page so it does not interfere with cpage_out that is used for
mapping other pages.
The development of this patch was aided by the follow script:
// <smpl>
// SPDX-License-Identifier: GPL-2.0-only
// Find kmap and replace with kmap_local_page then mark kunmap
//
// Confidence: Low
// Copyright: (C) 2021 Intel Corporation
// URL: http://coccinelle.lip6.fr/
@ catch_all @
expression e, e2;
@@
(
-kmap(e)
+kmap_local_page(e)
)
...
(
-kunmap(...)
+kunmap_local()
)
// </smpl>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/raid56.c')
-rw-r--r-- | fs/btrfs/raid56.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 0a2858609bb7..633b4b1b1ee1 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -2388,13 +2388,13 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio, /* Check scrubbing parity and repair it */ p = rbio_stripe_page(rbio, rbio->scrubp, pagenr); - parity = kmap(p); + parity = kmap_local_page(p); if (memcmp(parity, pointers[rbio->scrubp], PAGE_SIZE)) copy_page(parity, pointers[rbio->scrubp]); else /* Parity is right, needn't writeback */ bitmap_clear(rbio->dbitmap, pagenr, 1); - kunmap(p); + kunmap_local(parity); for (stripe = 0; stripe < nr_data; stripe++) kunmap(page_in_rbio(rbio, stripe, pagenr, 0)); |