--- /dev/null
+From ad3fc7946b1829213bbdbb2b9ad0d124b31ae4a7 Mon Sep 17 00:00:00 2001
+From: Filipe Manana <fdmanana@suse.com>
+Date: Thu, 3 Feb 2022 15:36:44 +0000
+Subject: btrfs: remove no longer used counter when reading data page
+
+From: Filipe Manana <fdmanana@suse.com>
+
+commit ad3fc7946b1829213bbdbb2b9ad0d124b31ae4a7 upstream.
+
+After commit 92082d40976ed0 ("btrfs: integrate page status update for
+data read path into begin/end_page_read"), the 'nr' counter at
+btrfs_do_readpage() is no longer used, we increment it but we never
+read from it. So just remove it.
+
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Cc: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/extent_io.c | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+--- a/fs/btrfs/extent_io.c
++++ b/fs/btrfs/extent_io.c
+@@ -3561,7 +3561,6 @@ int btrfs_do_readpage(struct page *page,
+ u64 cur_end;
+ struct extent_map *em;
+ int ret = 0;
+- int nr = 0;
+ size_t pg_offset = 0;
+ size_t iosize;
+ size_t blocksize = inode->i_sb->s_blocksize;
+@@ -3727,9 +3726,7 @@ int btrfs_do_readpage(struct page *page,
+ end_bio_extent_readpage, 0,
+ this_bio_flag,
+ force_bio_submit);
+- if (!ret) {
+- nr++;
+- } else {
++ if (ret) {
+ unlock_extent(tree, cur, cur + iosize - 1);
+ end_page_read(page, false, cur, iosize);
+ goto out;
--- /dev/null
+From cd9255be6980012ad54f2d4fd3941bc2586e43e5 Mon Sep 17 00:00:00 2001
+From: Qu Wenruo <wqu@suse.com>
+Date: Mon, 27 Sep 2021 15:21:43 +0800
+Subject: btrfs: remove unused parameter nr_pages in add_ra_bio_pages()
+
+From: Qu Wenruo <wqu@suse.com>
+
+commit cd9255be6980012ad54f2d4fd3941bc2586e43e5 upstream.
+
+Variable @nr_pages only gets increased but never used. Remove it.
+
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Cc: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/compression.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/fs/btrfs/compression.c
++++ b/fs/btrfs/compression.c
+@@ -550,7 +550,6 @@ static noinline int add_ra_bio_pages(str
+ u64 isize = i_size_read(inode);
+ int ret;
+ struct page *page;
+- unsigned long nr_pages = 0;
+ struct extent_map *em;
+ struct address_space *mapping = inode->i_mapping;
+ struct extent_map_tree *em_tree;
+@@ -646,7 +645,6 @@ static noinline int add_ra_bio_pages(str
+ PAGE_SIZE, 0);
+
+ if (ret == PAGE_SIZE) {
+- nr_pages++;
+ put_page(page);
+ } else {
+ unlock_extent(tree, last_offset, end);
--- /dev/null
+From 6d4a6b515c39f1f8763093e0f828959b2fbc2f45 Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Thu, 24 Mar 2022 08:36:45 -0700
+Subject: btrfs: remove unused variable in btrfs_{start,write}_dirty_block_groups()
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 6d4a6b515c39f1f8763093e0f828959b2fbc2f45 upstream.
+
+Clang's version of -Wunused-but-set-variable recently gained support for
+unary operations, which reveals two unused variables:
+
+ fs/btrfs/block-group.c:2949:6: error: variable 'num_started' set but not used [-Werror,-Wunused-but-set-variable]
+ int num_started = 0;
+ ^
+ fs/btrfs/block-group.c:3116:6: error: variable 'num_started' set but not used [-Werror,-Wunused-but-set-variable]
+ int num_started = 0;
+ ^
+ 2 errors generated.
+
+These variables appear to be unused from their introduction, so just
+remove them to silence the warnings.
+
+Fixes: c9dc4c657850 ("Btrfs: two stage dirty block group writeout")
+Fixes: 1bbc621ef284 ("Btrfs: allow block group cache writeout outside critical section in commit")
+CC: stable@vger.kernel.org # 5.4+
+Link: https://github.com/ClangBuiltLinux/linux/issues/1614
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/block-group.c | 4 ----
+ 1 file changed, 4 deletions(-)
+
+--- a/fs/btrfs/block-group.c
++++ b/fs/btrfs/block-group.c
+@@ -2882,7 +2882,6 @@ int btrfs_start_dirty_block_groups(struc
+ struct btrfs_path *path = NULL;
+ LIST_HEAD(dirty);
+ struct list_head *io = &cur_trans->io_bgs;
+- int num_started = 0;
+ int loops = 0;
+
+ spin_lock(&cur_trans->dirty_bgs_lock);
+@@ -2948,7 +2947,6 @@ again:
+ cache->io_ctl.inode = NULL;
+ ret = btrfs_write_out_cache(trans, cache, path);
+ if (ret == 0 && cache->io_ctl.inode) {
+- num_started++;
+ should_put = 0;
+
+ /*
+@@ -3049,7 +3047,6 @@ int btrfs_write_dirty_block_groups(struc
+ int should_put;
+ struct btrfs_path *path;
+ struct list_head *io = &cur_trans->io_bgs;
+- int num_started = 0;
+
+ path = btrfs_alloc_path();
+ if (!path)
+@@ -3107,7 +3104,6 @@ int btrfs_write_dirty_block_groups(struc
+ cache->io_ctl.inode = NULL;
+ ret = btrfs_write_out_cache(trans, cache, path);
+ if (ret == 0 && cache->io_ctl.inode) {
+- num_started++;
+ should_put = 0;
+ list_add_tail(&cache->io_list, io);
+ } else {
acpi-processor-idle-check-for-architectural-support-for-lpi.patch
acpi-processor-idle-allow-playing-dead-in-c3-state.patch
acpi-processor-idle-fix-lockup-regression-on-32-bit-thinkpad-t40.patch
+btrfs-remove-unused-parameter-nr_pages-in-add_ra_bio_pages.patch
+btrfs-remove-no-longer-used-counter-when-reading-data-page.patch
+btrfs-remove-unused-variable-in-btrfs_-start-write-_dirty_block_groups.patch