From 92697139b01339b6c0767fa1305a4df9a7c1f37f Mon Sep 17 00:00:00 2001 From: Guanjun Date: Mon, 27 Nov 2023 16:31:27 +0800 Subject: lib/find_bit: Fix the code comments about find_next_bit_wrap The function find_next_bit_wrap only has one memory region to search on. Adjust the comments. Signed-off-by: Guanjun Signed-off-by: Yury Norov --- include/linux/find.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/find.h b/include/linux/find.h index 5e4f39ef2e72cc..af63ae5b90137a 100644 --- a/include/linux/find.h +++ b/include/linux/find.h @@ -413,8 +413,8 @@ unsigned long find_next_and_bit_wrap(const unsigned long *addr1, } /** - * find_next_bit_wrap - find the next set bit in both memory regions - * @addr: The first address to base the search on + * find_next_bit_wrap - find the next set bit in a memory region + * @addr: The address to base the search on * @size: The bitmap size in bits * @offset: The bitnumber to start searching at * -- cgit 1.2.3-korg From 27c82f14e6d2bcb9f085bad37fe339227571de60 Mon Sep 17 00:00:00 2001 From: Yury Norov Date: Sat, 28 Oct 2023 12:05:29 -0700 Subject: lib/find: optimize find_*_bit_wrap When an offset is 0, there's no need to search a bitmap from the beginning after the 1st search failed, because each bit has already been tested. Signed-off-by: Yury Norov --- include/linux/find.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/find.h b/include/linux/find.h index af63ae5b90137a..c69598e383c161 100644 --- a/include/linux/find.h +++ b/include/linux/find.h @@ -405,7 +405,7 @@ unsigned long find_next_and_bit_wrap(const unsigned long *addr1, { unsigned long bit = find_next_and_bit(addr1, addr2, size, offset); - if (bit < size) + if (bit < size || offset == 0) return bit; bit = find_first_and_bit(addr1, addr2, offset); @@ -427,7 +427,7 @@ unsigned long find_next_bit_wrap(const unsigned long *addr, { unsigned long bit = find_next_bit(addr, size, offset); - if (bit < size) + if (bit < size || offset == 0) return bit; bit = find_first_bit(addr, offset); -- cgit 1.2.3-korg From fd8ed16c2419e23b7496e008e5f7be98da7fe2d5 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 22 Dec 2023 16:04:02 +0200 Subject: bitmap: Step down as a reviewer Too many things are going on, and reviewing BITMAP related code seems not the best I can do, hence step down as a reviewer of the BITMAP library. Signed-off-by: Andy Shevchenko Signed-off-by: Yury Norov --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 788be9ab5b733a..51983ed2d4e483 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3553,7 +3553,6 @@ F: include/uapi/linux/bfs_fs.h BITMAP API M: Yury Norov -R: Andy Shevchenko R: Rasmus Villemoes S: Maintained F: include/linux/bitfield.h -- cgit 1.2.3-korg