public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.10 0/1] btrfs: fix region size in count_bitmap_extents
@ 2023-10-31 12:48 Anastasia Belova
  2023-10-31 12:49 ` [PATCH 5.10 1/1] " Anastasia Belova
  0 siblings, 1 reply; 3+ messages in thread
From: Anastasia Belova @ 2023-10-31 12:48 UTC (permalink / raw)
  To: Chris Mason
  Cc: Anastasia Belova, Josef Bacik, David Sterba, Dennis Zhou,
	linux-btrfs, linux-kernel, lvc-project, Greg Kroah-Hartman,
	stable

Function count_bitmap_extents was deleted in version
5.11, but there is typo in versions 5.6-5.10. The
following patch may fix it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 5.10 1/1] btrfs: fix region size in count_bitmap_extents
  2023-10-31 12:48 [PATCH 5.10 0/1] btrfs: fix region size in count_bitmap_extents Anastasia Belova
@ 2023-10-31 12:49 ` Anastasia Belova
  2023-10-31 14:29   ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Anastasia Belova @ 2023-10-31 12:49 UTC (permalink / raw)
  To: Chris Mason
  Cc: Anastasia Belova, Josef Bacik, David Sterba, Dennis Zhou,
	linux-btrfs, linux-kernel, lvc-project, Greg Kroah-Hartman,
	stable

Region size should be calculated by subtracting
the end from the beginning.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: dfb79ddb130e ("btrfs: track discardable extents for async discard")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
 fs/btrfs/free-space-cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 4989c60b1df9..a34e266a0969 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1930,7 +1930,7 @@ static int count_bitmap_extents(struct btrfs_free_space_ctl *ctl,
 
 	bitmap_for_each_set_region(bitmap_info->bitmap, rs, re, 0,
 				   BITS_PER_BITMAP) {
-		bytes -= (rs - re) * ctl->unit;
+		bytes -= (re - rs) * ctl->unit;
 		count++;
 
 		if (!bytes)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 5.10 1/1] btrfs: fix region size in count_bitmap_extents
  2023-10-31 12:49 ` [PATCH 5.10 1/1] " Anastasia Belova
@ 2023-10-31 14:29   ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2023-10-31 14:29 UTC (permalink / raw)
  To: Anastasia Belova; +Cc: stable, oe-kbuild-all

Hi,

Thanks for your patch.

FYI: kernel test robot notices the stable kernel rule is not satisfied.

The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-3

Rule: The upstream commit ID must be specified with a separate line above the commit text.
Subject: [PATCH 5.10 1/1] btrfs: fix region size in count_bitmap_extents
Link: https://lore.kernel.org/stable/20231031124900.19597-2-abelova%40astralinux.ru

Please ignore this mail if the patch is not relevant for upstream.

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-31 14:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 12:48 [PATCH 5.10 0/1] btrfs: fix region size in count_bitmap_extents Anastasia Belova
2023-10-31 12:49 ` [PATCH 5.10 1/1] " Anastasia Belova
2023-10-31 14:29   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox