2020-03-13 18:49:52

by Qiujun Huang

[permalink] [raw]
Subject: [PATCH 0/2] radix-tree: fix some errors in comment

Update the comment.

Qiujun Huang (2):
radix-tree: fix kernel-doc for radix_tree_find_next_bit
radix-tree: fix a typo

lib/radix-tree.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

--
2.17.1


2020-03-13 18:49:58

by Qiujun Huang

[permalink] [raw]
Subject: [PATCH 1/2] radix-tree: fix kernel-doc for radix_tree_find_next_bit

The function changed at some point, but the kernel-doc was
not updated.

Signed-off-by: Qiujun Huang <[email protected]>
---
lib/radix-tree.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index c8fa1d274530..379137875e25 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -178,12 +178,11 @@ static inline void all_tag_set(struct radix_tree_node *node, unsigned int tag)
* radix_tree_find_next_bit - find the next set bit in a memory region
*
* @addr: The address to base the search on
- * @size: The bitmap size in bits
+ * @tag: The tag index (< RADIX_TREE_MAX_TAGS)
* @offset: The bitnumber to start searching at
*
* Unrollable variant of find_next_bit() for constant size arrays.
- * Tail bits starting from size to roundup(size, BITS_PER_LONG) must be zero.
- * Returns next bit offset, or size if nothing found.
+ * Returns next bit offset, or RADIX_TREE_MAP_SIZE if nothing found.
*/
static __always_inline unsigned long
radix_tree_find_next_bit(struct radix_tree_node *node, unsigned int tag,
--
2.17.1

2020-03-13 18:50:43

by Qiujun Huang

[permalink] [raw]
Subject: [PATCH 2/2] radix-tree: fix a typo

"iff" -> "if"

Signed-off-by: Qiujun Huang <[email protected]>
---
lib/radix-tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 379137875e25..0534823adf07 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -794,7 +794,7 @@ void *__radix_tree_lookup(const struct radix_tree_root *root,
* Returns: the slot corresponding to the position @index in the
* radix tree @root. This is useful for update-if-exists operations.
*
- * This function can be called under rcu_read_lock iff the slot is not
+ * This function can be called under rcu_read_lock if the slot is not
* modified by radix_tree_replace_slot, otherwise it must be called
* exclusive from other writers. Any dereference of the slot must be done
* using radix_tree_deref_slot.
--
2.17.1

2020-03-13 19:13:29

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH 2/2] radix-tree: fix a typo

On Sat, Mar 14, 2020 at 02:49:09AM +0800, Qiujun Huang wrote:
> "iff" -> "if"

> - * This function can be called under rcu_read_lock iff the slot is not
> + * This function can be called under rcu_read_lock if the slot is not

That's not a typo, it's a mathematician's shorthand for "if and only if".
I'm not excited about fixing problems in the radix tree code; better to
focus efforts on migrating users to the xarray.

http://git.infradead.org/users/willy/linux-dax.git/shortlog/refs/heads/xarray-conv
is an out of date effort to do every user.

2020-03-13 19:16:35

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH 1/2] radix-tree: fix kernel-doc for radix_tree_find_next_bit

On Sat, Mar 14, 2020 at 02:49:08AM +0800, Qiujun Huang wrote:
> * radix_tree_find_next_bit - find the next set bit in a memory region
> *
> * @addr: The address to base the search on
> - * @size: The bitmap size in bits
> + * @tag: The tag index (< RADIX_TREE_MAX_TAGS)
> * @offset: The bitnumber to start searching at
> *
> * Unrollable variant of find_next_bit() for constant size arrays.
> - * Tail bits starting from size to roundup(size, BITS_PER_LONG) must be zero.
> - * Returns next bit offset, or size if nothing found.
> + * Returns next bit offset, or RADIX_TREE_MAP_SIZE if nothing found.
> */
> static __always_inline unsigned long
> radix_tree_find_next_bit(struct radix_tree_node *node, unsigned int tag,

Ugh, this is a static function with kernel-doc. What a waste of time ;-(

2020-03-13 23:18:59

by Qiujun Huang

[permalink] [raw]
Subject: Re: [PATCH 2/2] radix-tree: fix a typo

On Sat, Mar 14, 2020 at 3:12 AM Matthew Wilcox <[email protected]> wrote:
>
> On Sat, Mar 14, 2020 at 02:49:09AM +0800, Qiujun Huang wrote:
> > "iff" -> "if"
>
> > - * This function can be called under rcu_read_lock iff the slot is not
> > + * This function can be called under rcu_read_lock if the slot is not
>
> That's not a typo, it's a mathematician's shorthand for "if and only if".
> I'm not excited about fixing problems in the radix tree code; better to
> focus efforts on migrating users to the xarray.

I get that, thanks.

>
> http://git.infradead.org/users/willy/linux-dax.git/shortlog/refs/heads/xarray-conv
> is an out of date effort to do every user.

2020-03-13 23:20:27

by Qiujun Huang

[permalink] [raw]
Subject: Re: [PATCH 1/2] radix-tree: fix kernel-doc for radix_tree_find_next_bit

I thought it's better to update the function description as it could
be more readable from source code.

On Sat, Mar 14, 2020 at 3:14 AM Matthew Wilcox <[email protected]> wrote:
>
> On Sat, Mar 14, 2020 at 02:49:08AM +0800, Qiujun Huang wrote:
> > * radix_tree_find_next_bit - find the next set bit in a memory region
> > *
> > * @addr: The address to base the search on
> > - * @size: The bitmap size in bits
> > + * @tag: The tag index (< RADIX_TREE_MAX_TAGS)
> > * @offset: The bitnumber to start searching at
> > *
> > * Unrollable variant of find_next_bit() for constant size arrays.
> > - * Tail bits starting from size to roundup(size, BITS_PER_LONG) must be zero.
> > - * Returns next bit offset, or size if nothing found.
> > + * Returns next bit offset, or RADIX_TREE_MAP_SIZE if nothing found.
> > */
> > static __always_inline unsigned long
> > radix_tree_find_next_bit(struct radix_tree_node *node, unsigned int tag,
>
> Ugh, this is a static function with kernel-doc. What a waste of time ;-(