]> git.itanic.dy.fi Git - linux-stable/commit
btrfs: zoned: fix wrong use of bitops API in btrfs_ensure_empty_zones
authorNaohiro Aota <naohiro.aota@wdc.com>
Tue, 18 Apr 2023 08:45:24 +0000 (17:45 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:50:21 +0000 (11:50 +0200)
commit91f585024e3eb4f3926648086022a44a654649b7
treec8bbceb790eeb4b07f2d3e9381aeca3b801addb6
parent77c6323dad14cf74a5576d3d39f8e62671963c87
btrfs: zoned: fix wrong use of bitops API in btrfs_ensure_empty_zones

commit 631003e2333c12cc1b52df06a707365b7363a159 upstream.

find_next_bit and find_next_zero_bit take @size as the second parameter and
@offset as the third parameter. They are specified opposite in
btrfs_ensure_empty_zones(). Thanks to the later loop, it never failed to
detect the empty zones. Fix them and (maybe) return the result a bit
faster.

Note: the naming is a bit confusing, size has two meanings here, bitmap
and our range size.

Fixes: 1cd6121f2a38 ("btrfs: zoned: implement zoned chunk allocator")
CC: stable@vger.kernel.org # 5.15+
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/zoned.c