--- /dev/null
+btrfs-raid56-simplify-tracking-of-q-stripe-presence.patch
+btrfs-fix-raid6-qstripe-kmap.patch
+pm-runtime-update-device-status-before-letting-suppliers-suspend.patch
--- /dev/null
+btrfs-raid56-simplify-tracking-of-q-stripe-presence.patch
+btrfs-fix-raid6-qstripe-kmap.patch
+btrfs-validate-qgroup-inherit-for-snap_create_v2-ioctl.patch
+btrfs-free-correct-amount-of-space-in-btrfs_delayed_inode_reserve_metadata.patch
+btrfs-unlock-extents-in-btrfs_zero_range-in-case-of-quota-reservation-errors.patch
+pm-runtime-update-device-status-before-letting-suppliers-suspend.patch
+dm-bufio-subtract-the-number-of-initial-sectors-in-dm_bufio_get_device_size.patch
+drm-amdgpu-fix-parameter-error-of-rreg32_pcie-in-amdgpu_regs_pcie.patch
--- /dev/null
+From d70cef0d46729808dc53f145372c02b145c92604 Mon Sep 17 00:00:00 2001
+From: Ira Weiny <ira.weiny@intel.com>
+Date: Wed, 27 Jan 2021 22:15:03 -0800
+Subject: btrfs: fix raid6 qstripe kmap
+
+From: Ira Weiny <ira.weiny@intel.com>
+
+commit d70cef0d46729808dc53f145372c02b145c92604 upstream.
+
+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: 5a6ac9eacb49 ("Btrfs, raid56: support parity scrub on raid56")
+CC: stable@vger.kernel.org # 4.4.x: c17af96554a8: 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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/raid56.c | 21 ++++++++++-----------
+ 1 file changed, 10 insertions(+), 11 deletions(-)
+
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -2341,16 +2341,21 @@ static noinline void finish_parity_scrub
+ SetPageUptodate(p_page);
+
+ if (has_qstripe) {
++ /* RAID6, allocate and map temp space for the Q stripe */
+ q_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
+ if (!q_page) {
+ __free_page(p_page);
+ goto cleanup;
+ }
+ SetPageUptodate(q_page);
++ pointers[rbio->real_stripes - 1] = kmap(q_page);
+ }
+
+ atomic_set(&rbio->error, 0);
+
++ /* Map the parity stripe just once */
++ pointers[nr_data] = kmap(p_page);
++
+ for_each_set_bit(pagenr, rbio->dbitmap, rbio->stripe_npages) {
+ struct page *p;
+ void *parity;
+@@ -2360,16 +2365,8 @@ static noinline void finish_parity_scrub
+ pointers[stripe] = kmap(p);
+ }
+
+- /* then add the parity stripe */
+- pointers[stripe++] = kmap(p_page);
+-
+ if (has_qstripe) {
+- /*
+- * raid6, add the qstripe and call the
+- * library function to fill in our p/q
+- */
+- pointers[stripe++] = kmap(q_page);
+-
++ /* RAID6, call the library function to fill in our P/Q */
+ raid6_call.gen_syndrome(rbio->real_stripes, PAGE_SIZE,
+ pointers);
+ } else {
+@@ -2390,12 +2387,14 @@ static noinline void finish_parity_scrub
+
+ for (stripe = 0; stripe < nr_data; stripe++)
+ kunmap(page_in_rbio(rbio, stripe, pagenr, 0));
+- kunmap(p_page);
+ }
+
++ kunmap(p_page);
+ __free_page(p_page);
+- if (q_page)
++ if (q_page) {
++ kunmap(q_page);
+ __free_page(q_page);
++ }
+
+ writeback:
+ /*
--- /dev/null
+From c17af96554a8a8777cbb0fd53b8497250e548b43 Mon Sep 17 00:00:00 2001
+From: David Sterba <dsterba@suse.com>
+Date: Wed, 19 Feb 2020 15:17:20 +0100
+Subject: btrfs: raid56: simplify tracking of Q stripe presence
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: David Sterba <dsterba@suse.com>
+
+commit c17af96554a8a8777cbb0fd53b8497250e548b43 upstream.
+
+There are temporary variables tracking the index of P and Q stripes, but
+none of them is really used as such, merely for determining if the Q
+stripe is present. This leads to compiler warnings with
+-Wunused-but-set-variable and has been reported several times.
+
+fs/btrfs/raid56.c: In function ‘finish_rmw’:
+fs/btrfs/raid56.c:1199:6: warning: variable ‘p_stripe’ set but not used [-Wunused-but-set-variable]
+ 1199 | int p_stripe = -1;
+ | ^~~~~~~~
+fs/btrfs/raid56.c: In function ‘finish_parity_scrub’:
+fs/btrfs/raid56.c:2356:6: warning: variable ‘p_stripe’ set but not used [-Wunused-but-set-variable]
+ 2356 | int p_stripe = -1;
+ | ^~~~~~~~
+
+Replace the two variables with one that has a clear meaning and also get
+rid of the warnings. The logic that verifies that there are only 2
+valid cases is unchanged.
+
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/raid56.c | 37 +++++++++++++++----------------------
+ 1 file changed, 15 insertions(+), 22 deletions(-)
+
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -1179,22 +1179,19 @@ static noinline void finish_rmw(struct b
+ int nr_data = rbio->nr_data;
+ int stripe;
+ int pagenr;
+- int p_stripe = -1;
+- int q_stripe = -1;
++ bool has_qstripe;
+ struct bio_list bio_list;
+ struct bio *bio;
+ int ret;
+
+ bio_list_init(&bio_list);
+
+- if (rbio->real_stripes - rbio->nr_data == 1) {
+- p_stripe = rbio->real_stripes - 1;
+- } else if (rbio->real_stripes - rbio->nr_data == 2) {
+- p_stripe = rbio->real_stripes - 2;
+- q_stripe = rbio->real_stripes - 1;
+- } else {
++ if (rbio->real_stripes - rbio->nr_data == 1)
++ has_qstripe = false;
++ else if (rbio->real_stripes - rbio->nr_data == 2)
++ has_qstripe = true;
++ else
+ BUG();
+- }
+
+ /* at this point we either have a full stripe,
+ * or we've read the full stripe from the drive.
+@@ -1238,7 +1235,7 @@ static noinline void finish_rmw(struct b
+ SetPageUptodate(p);
+ pointers[stripe++] = kmap(p);
+
+- if (q_stripe != -1) {
++ if (has_qstripe) {
+
+ /*
+ * raid6, add the qstripe and call the
+@@ -2306,8 +2303,7 @@ static noinline void finish_parity_scrub
+ int nr_data = rbio->nr_data;
+ int stripe;
+ int pagenr;
+- int p_stripe = -1;
+- int q_stripe = -1;
++ bool has_qstripe;
+ struct page *p_page = NULL;
+ struct page *q_page = NULL;
+ struct bio_list bio_list;
+@@ -2317,14 +2313,12 @@ static noinline void finish_parity_scrub
+
+ bio_list_init(&bio_list);
+
+- if (rbio->real_stripes - rbio->nr_data == 1) {
+- p_stripe = rbio->real_stripes - 1;
+- } else if (rbio->real_stripes - rbio->nr_data == 2) {
+- p_stripe = rbio->real_stripes - 2;
+- q_stripe = rbio->real_stripes - 1;
+- } else {
++ if (rbio->real_stripes - rbio->nr_data == 1)
++ has_qstripe = false;
++ else if (rbio->real_stripes - rbio->nr_data == 2)
++ has_qstripe = true;
++ else
+ BUG();
+- }
+
+ if (bbio->num_tgtdevs && bbio->tgtdev_map[rbio->scrubp]) {
+ is_replace = 1;
+@@ -2346,7 +2340,7 @@ static noinline void finish_parity_scrub
+ goto cleanup;
+ SetPageUptodate(p_page);
+
+- if (q_stripe != -1) {
++ if (has_qstripe) {
+ q_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
+ if (!q_page) {
+ __free_page(p_page);
+@@ -2369,8 +2363,7 @@ static noinline void finish_parity_scrub
+ /* then add the parity stripe */
+ pointers[stripe++] = kmap(p_page);
+
+- if (q_stripe != -1) {
+-
++ if (has_qstripe) {
+ /*
+ * raid6, add the qstripe and call the
+ * library function to fill in our p/q
--- /dev/null
+btrfs-raid56-simplify-tracking-of-q-stripe-presence.patch
+btrfs-fix-raid6-qstripe-kmap.patch
--- /dev/null
+alsa-hda-realtek-enable-headset-mic-of-acer-swift-with-alc256.patch
+alsa-usb-audio-use-corsair-virtuoso-mapping-for-corsair-virtuoso-se.patch
+alsa-usb-audio-drop-bogus-db-range-in-too-low-level.patch
+tpm-tpm_tis-decorate-tpm_tis_gen_interrupt-with-request_locality.patch
+tpm-tpm_tis-decorate-tpm_get_timeouts-with-request_locality.patch
+btrfs-avoid-double-put-of-block-group-when-emptying-cluster.patch
+btrfs-fix-raid6-qstripe-kmap.patch
+btrfs-fix-race-between-writes-to-swap-files-and-scrub.patch
+btrfs-fix-race-between-swap-file-activation-and-snapshot-creation.patch
+btrfs-fix-stale-data-exposure-after-cloning-a-hole-with-no_holes-enabled.patch
+btrfs-fix-race-between-extent-freeing-allocation-when-using-bitmaps.patch
+btrfs-validate-qgroup-inherit-for-snap_create_v2-ioctl.patch
+btrfs-free-correct-amount-of-space-in-btrfs_delayed_inode_reserve_metadata.patch
+btrfs-unlock-extents-in-btrfs_zero_range-in-case-of-quota-reservation-errors.patch
+btrfs-fix-warning-when-creating-a-directory-with-smack-enabled.patch
+pm-runtime-update-device-status-before-letting-suppliers-suspend.patch
+ring-buffer-force-before_stamp-and-write_stamp-to-be-different-on-discard.patch
+io_uring-ignore-double-poll-add-on-the-same-waitqueue-head.patch
+dm-bufio-subtract-the-number-of-initial-sectors-in-dm_bufio_get_device_size.patch
+dm-verity-fix-fec-for-rs-roots-unaligned-to-block-size.patch
+drm-amdgpu-disable-vcn-for-navi12-sku.patch
+drm-amdgpu-fix-parameter-error-of-rreg32_pcie-in-amdgpu_regs_pcie.patch
--- /dev/null
+alsa-hda-realtek-enable-headset-mic-of-acer-swift-with-alc256.patch
+alsa-usb-audio-use-corsair-virtuoso-mapping-for-corsair-virtuoso-se.patch
+alsa-usb-audio-don-t-abort-even-if-the-clock-rate-differs.patch
+alsa-usb-audio-drop-bogus-db-range-in-too-low-level.patch
+alsa-usb-audio-allow-modifying-parameters-with-succeeding-hw_params-calls.patch
+tpm-tpm_tis-decorate-tpm_tis_gen_interrupt-with-request_locality.patch
+tpm-tpm_tis-decorate-tpm_get_timeouts-with-request_locality.patch
+btrfs-avoid-double-put-of-block-group-when-emptying-cluster.patch
+btrfs-fix-raid6-qstripe-kmap.patch
+btrfs-fix-race-between-writes-to-swap-files-and-scrub.patch
+btrfs-fix-race-between-swap-file-activation-and-snapshot-creation.patch
+btrfs-fix-stale-data-exposure-after-cloning-a-hole-with-no_holes-enabled.patch
+btrfs-tree-checker-do-not-error-out-if-extent-ref-hash-doesn-t-match.patch
+btrfs-fix-race-between-extent-freeing-allocation-when-using-bitmaps.patch
+btrfs-validate-qgroup-inherit-for-snap_create_v2-ioctl.patch
+btrfs-free-correct-amount-of-space-in-btrfs_delayed_inode_reserve_metadata.patch
+btrfs-don-t-flush-from-btrfs_delayed_inode_reserve_metadata.patch
+btrfs-fix-spurious-free_space_tree-remount-warning.patch
+btrfs-unlock-extents-in-btrfs_zero_range-in-case-of-quota-reservation-errors.patch
+btrfs-fix-warning-when-creating-a-directory-with-smack-enabled.patch
+pm-runtime-update-device-status-before-letting-suppliers-suspend.patch
+ring-buffer-force-before_stamp-and-write_stamp-to-be-different-on-discard.patch
+io_uring-ignore-double-poll-add-on-the-same-waitqueue-head.patch
+dm-bufio-subtract-the-number-of-initial-sectors-in-dm_bufio_get_device_size.patch
+dm-verity-fix-fec-for-rs-roots-unaligned-to-block-size.patch
+drm-amd-pm-correct-arcturus-mmthm_baco_cntl-register-address.patch
+drm-amdgpu-disable-vcn-for-navi12-sku.patch
+drm-amdgpu-only-check-for-s0ix-if-amd_pmc-is-configured.patch
+drm-amdgpu-fix-parameter-error-of-rreg32_pcie-in-amdgpu_regs_pcie.patch
--- /dev/null
+tpm-tpm_tis-decorate-tpm_tis_gen_interrupt-with-request_locality.patch
+tpm-tpm_tis-decorate-tpm_get_timeouts-with-request_locality.patch
+btrfs-raid56-simplify-tracking-of-q-stripe-presence.patch
+btrfs-fix-raid6-qstripe-kmap.patch
+btrfs-validate-qgroup-inherit-for-snap_create_v2-ioctl.patch
+btrfs-free-correct-amount-of-space-in-btrfs_delayed_inode_reserve_metadata.patch
+btrfs-unlock-extents-in-btrfs_zero_range-in-case-of-quota-reservation-errors.patch
+btrfs-fix-warning-when-creating-a-directory-with-smack-enabled.patch
+pm-runtime-update-device-status-before-letting-suppliers-suspend.patch
+dm-bufio-subtract-the-number-of-initial-sectors-in-dm_bufio_get_device_size.patch
+dm-verity-fix-fec-for-rs-roots-unaligned-to-block-size.patch
+drm-amdgpu-fix-parameter-error-of-rreg32_pcie-in-amdgpu_regs_pcie.patch