]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix raid6 qstripe kmap
authorIra Weiny <ira.weiny@intel.com>
Thu, 28 Jan 2021 06:15:03 +0000 (22:15 -0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 22 Feb 2021 16:15:21 +0000 (17:15 +0100)
commit8ded09b3b5663160897b62cfdc5554f1f8543423
tree8b481479b06e956d9c4000c57ef8b2c890d51430
parent19dd84545f344fcf78c7ab1a5e8fef86ba083d12
btrfs: fix raid6 qstripe kmap

When a qstripe is required an extra page is allocated and mapped.  There
were 3 problems:

1) There is no corresponding call of kunmap() for the qstripe page.
2) There is no reason to map the qstripe page more than once if the
   number of bits set in rbio->dbitmap is greater than one.
3) There is no reason to map the parity page and unmap it each time
   through the loop.

The page memory can continue to be reused with a single mapping on each
iteration by raid6_call.gen_syndrome() without remapping.  So map the
page for the duration of the loop.

Similarly, improve the algorithm by mapping the parity page just 1 time.

Fixes: 6ef0ee7ebf35 ("Btrfs, raid56: support parity scrub on raid56")
CC: stable@vger.kernel.org # 4.4.x: b9e97d651493: btrfs: raid56: simplify tracking of Q stripe presence
CC: stable@vger.kernel.org # 4.4.x
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid56.c