Skip to contentSkip to conversation

radix-tree: fix some errors in comment

PATCH In review Qiujun Huang 2 participants 7 messages Mar 13, 2020 Library code

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
2.17.1
#1 lore raw

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.

---
 lib/radix-tree.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
lib/radix-tree.c +2 -3
index c8fa1d274530..379137875e25 100644
@@ -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,
Signature · 1 line
2.17.1
#2 lore raw

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

Quoted 6 lines · Qiujun Huang

* 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

Quoted 8 lines

*
* 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 ;-(

#3 lore raw

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.

Quoted 18 lines · Matthew Wilcox
Quoted 6 lines · Qiujun Huang

* 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

Quoted 8 lines

*
* 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 ;-(

#4 lore raw

PATCH 2/2 radix-tree: fix a typo

In reply to Qiujun Huang

"iff" -> "if"

---
 lib/radix-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/radix-tree.c +1 -1
index 379137875e25..0534823adf07 100644
@@ -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.
Signature · 1 line
2.17.1
#5 lore raw

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

Quoted 4 lines · Qiujun Huang

"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.

#6 lore raw

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

Quoted 10 lines · Matthew Wilcox
Quoted 4 lines · Qiujun Huang

"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.

Quoted 3 lines

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