mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 21:14:56 -04:00
staging: lustre: ldlm: restore interval_iterate_reverse function
Earlier the function interval_iterate_reverse function was removed since it wasn't used by anyone. Now it is being restored since it will be used by a future patch. Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e16ffa838b
commit
ec57d6e63c
@@ -111,4 +111,8 @@ enum interval_iter interval_search(struct interval_node *root,
|
||||
struct interval_node_extent *ex,
|
||||
interval_callback_t func, void *data);
|
||||
|
||||
enum interval_iter interval_iterate_reverse(struct interval_node *root,
|
||||
interval_callback_t func,
|
||||
void *data);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -110,6 +110,15 @@ static struct interval_node *interval_first(struct interval_node *node)
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct interval_node *interval_last(struct interval_node *node)
|
||||
{
|
||||
if (!node)
|
||||
return NULL;
|
||||
while (node->in_right)
|
||||
node = node->in_right;
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct interval_node *interval_next(struct interval_node *node)
|
||||
{
|
||||
if (!node)
|
||||
@@ -121,6 +130,37 @@ static struct interval_node *interval_next(struct interval_node *node)
|
||||
return node->in_parent;
|
||||
}
|
||||
|
||||
static struct interval_node *interval_prev(struct interval_node *node)
|
||||
{
|
||||
if (!node)
|
||||
return NULL;
|
||||
|
||||
if (node->in_left)
|
||||
return interval_last(node->in_left);
|
||||
|
||||
while (node->in_parent && node_is_left_child(node))
|
||||
node = node->in_parent;
|
||||
|
||||
return node->in_parent;
|
||||
}
|
||||
|
||||
enum interval_iter interval_iterate_reverse(struct interval_node *root,
|
||||
interval_callback_t func,
|
||||
void *data)
|
||||
{
|
||||
enum interval_iter rc = INTERVAL_ITER_CONT;
|
||||
struct interval_node *node;
|
||||
|
||||
for (node = interval_last(root); node; node = interval_prev(node)) {
|
||||
rc = func(node, data);
|
||||
if (rc == INTERVAL_ITER_STOP)
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(interval_iterate_reverse);
|
||||
|
||||
static void __rotate_change_maxhigh(struct interval_node *node,
|
||||
struct interval_node *rotate)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user