From: Sasha Levin Date: Fri, 31 Mar 2023 19:07:55 +0000 (-0400) Subject: Fixes for 6.2 X-Git-Tag: v4.14.312~54 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a728a23d09cafce14871c6dc6558a080b7b5a903;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.2 Signed-off-by: Sasha Levin --- diff --git a/queue-6.2/btrfs-fix-uninitialized-variable-warning-in-btrfs_up.patch b/queue-6.2/btrfs-fix-uninitialized-variable-warning-in-btrfs_up.patch new file mode 100644 index 00000000000..081f7018737 --- /dev/null +++ b/queue-6.2/btrfs-fix-uninitialized-variable-warning-in-btrfs_up.patch @@ -0,0 +1,41 @@ +From 6d30334c0b85a37a38d8572d5f647a79587000d1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Dec 2022 15:15:54 -0500 +Subject: btrfs: fix uninitialized variable warning in btrfs_update_block_group + +From: Josef Bacik + +[ Upstream commit efbf35a102b20246cfe4409c6ae92e72ecb67ab8 ] + +reclaim isn't set in the alloc case, however we only care about +reclaim in the !alloc case. This isn't an actual problem, however +-Wmaybe-uninitialized will complain, so initialize reclaim to quiet the +compiler. + +Reviewed-by: Qu Wenruo +Reviewed-by: Johannes Thumshirn +Signed-off-by: Josef Bacik +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Stable-dep-of: df384da5a49c ("btrfs: use temporary variable for space_info in btrfs_update_block_group") +Signed-off-by: Sasha Levin +--- + fs/btrfs/block-group.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c +index 8eb625318e785..f40e56d44276d 100644 +--- a/fs/btrfs/block-group.c ++++ b/fs/btrfs/block-group.c +@@ -3336,7 +3336,7 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans, + spin_unlock(&info->delalloc_root_lock); + + while (total) { +- bool reclaim; ++ bool reclaim = false; + + cache = btrfs_lookup_block_group(info, bytenr); + if (!cache) { +-- +2.39.2 + diff --git a/queue-6.2/btrfs-use-temporary-variable-for-space_info-in-btrfs.patch b/queue-6.2/btrfs-use-temporary-variable-for-space_info-in-btrfs.patch new file mode 100644 index 00000000000..6e45cb42010 --- /dev/null +++ b/queue-6.2/btrfs-use-temporary-variable-for-space_info-in-btrfs.patch @@ -0,0 +1,94 @@ +From 43d1f156a65821f05675d62932d8e52b2768e6d0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Mar 2023 16:14:43 -0500 +Subject: btrfs: use temporary variable for space_info in + btrfs_update_block_group + +From: Josef Bacik + +[ Upstream commit df384da5a49cace5c5e3100803dfd563fd982f93 ] + +We do + + cache->space_info->counter += num_bytes; + +everywhere in here. This is makes the lines longer than they need to +be, and will be especially noticeable when we add the active tracking in, +so add a temp variable for the space_info so this is cleaner. + +Reviewed-by: Naohiro Aota +Reviewed-by: Johannes Thumshirn +Reviewed-by: Anand Jain +Signed-off-by: Josef Bacik +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Sasha Levin +--- + fs/btrfs/block-group.c | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c +index f40e56d44276d..c70a888bf8bf6 100644 +--- a/fs/btrfs/block-group.c ++++ b/fs/btrfs/block-group.c +@@ -3336,6 +3336,7 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans, + spin_unlock(&info->delalloc_root_lock); + + while (total) { ++ struct btrfs_space_info *space_info; + bool reclaim = false; + + cache = btrfs_lookup_block_group(info, bytenr); +@@ -3343,6 +3344,7 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans, + ret = -ENOENT; + break; + } ++ space_info = cache->space_info; + factor = btrfs_bg_type_to_factor(cache->flags); + + /* +@@ -3357,7 +3359,7 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans, + byte_in_group = bytenr - cache->start; + WARN_ON(byte_in_group > cache->length); + +- spin_lock(&cache->space_info->lock); ++ spin_lock(&space_info->lock); + spin_lock(&cache->lock); + + if (btrfs_test_opt(info, SPACE_CACHE) && +@@ -3370,23 +3372,23 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans, + old_val += num_bytes; + cache->used = old_val; + cache->reserved -= num_bytes; +- cache->space_info->bytes_reserved -= num_bytes; +- cache->space_info->bytes_used += num_bytes; +- cache->space_info->disk_used += num_bytes * factor; ++ space_info->bytes_reserved -= num_bytes; ++ space_info->bytes_used += num_bytes; ++ space_info->disk_used += num_bytes * factor; + spin_unlock(&cache->lock); +- spin_unlock(&cache->space_info->lock); ++ spin_unlock(&space_info->lock); + } else { + old_val -= num_bytes; + cache->used = old_val; + cache->pinned += num_bytes; +- btrfs_space_info_update_bytes_pinned(info, +- cache->space_info, num_bytes); +- cache->space_info->bytes_used -= num_bytes; +- cache->space_info->disk_used -= num_bytes * factor; ++ btrfs_space_info_update_bytes_pinned(info, space_info, ++ num_bytes); ++ space_info->bytes_used -= num_bytes; ++ space_info->disk_used -= num_bytes * factor; + + reclaim = should_reclaim_block_group(cache, num_bytes); + spin_unlock(&cache->lock); +- spin_unlock(&cache->space_info->lock); ++ spin_unlock(&space_info->lock); + + set_extent_dirty(&trans->transaction->pinned_extents, + bytenr, bytenr + num_bytes - 1, +-- +2.39.2 + diff --git a/queue-6.2/series b/queue-6.2/series index 5433b49c110..29e6702d66e 100644 --- a/queue-6.2/series +++ b/queue-6.2/series @@ -57,3 +57,5 @@ fbdev-au1200fb-fix-potential-divide-by-zero.patch tools-power-turbostat-fix-dev-cpu_dma_latency-warnin.patch tools-power-turbostat-fix-decoding-of-hwp_status.patch tracing-fix-wrong-return-in-kprobe_event_gen_test.c.patch +btrfs-fix-uninitialized-variable-warning-in-btrfs_up.patch +btrfs-use-temporary-variable-for-space_info-in-btrfs.patch