Commit 32605a18 authored by Marcelo Tosatti's avatar Marcelo Tosatti Committed by Linus Torvalds

[PATCH] radix_tag_get(): differentiate between no present node and tag unset cases

Simple patch to radix_tree_tag_get() to return different values for non
present node and tag unset.

The function is not used by any in-kernel callers (yet), but this
information is definitely useful.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 201b6264
...@@ -418,15 +418,16 @@ EXPORT_SYMBOL(radix_tree_tag_clear); ...@@ -418,15 +418,16 @@ EXPORT_SYMBOL(radix_tree_tag_clear);
#ifndef __KERNEL__ /* Only the test harness uses this at present */ #ifndef __KERNEL__ /* Only the test harness uses this at present */
/** /**
* radix_tree_tag_get - get a tag on a radix tree node * radix_tree_tag_get - get a tag on a radix tree node
* @root: radix tree root * @root: radix tree root
* @index: index key * @index: index key
* @tag: tag index * @tag: tag index
* *
* Return the search tag corresponging to @index in the radix tree. * Return values:
* *
* Returns zero if the tag is unset, or if there is no corresponding item * 0: tag not present
* in the tree. * 1: tag present, set
* -1: tag present, unset
*/ */
int radix_tree_tag_get(struct radix_tree_root *root, int radix_tree_tag_get(struct radix_tree_root *root,
unsigned long index, int tag) unsigned long index, int tag)
...@@ -460,7 +461,7 @@ int radix_tree_tag_get(struct radix_tree_root *root, ...@@ -460,7 +461,7 @@ int radix_tree_tag_get(struct radix_tree_root *root,
int ret = tag_get(slot, tag, offset); int ret = tag_get(slot, tag, offset);
BUG_ON(ret && saw_unset_tag); BUG_ON(ret && saw_unset_tag);
return ret; return ret ? 1 : -1;
} }
slot = slot->slots[offset]; slot = slot->slots[offset];
shift -= RADIX_TREE_MAP_SHIFT; shift -= RADIX_TREE_MAP_SHIFT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment