*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/ldlm/interval_tree.c
*
return extent_compare(&n1->in_extent, &n2->in_extent);
}
-int node_equal(struct interval_node *n1, struct interval_node *n2)
-{
- return extent_equal(&n1->in_extent, &n2->in_extent);
-}
-
-static inline __u64 max_u64(__u64 x, __u64 y)
-{
- return x > y ? x : y;
-}
-
-static inline __u64 min_u64(__u64 x, __u64 y)
-{
- return x < y ? x : y;
-}
-
#define interval_for_each(node, root) \
for (node = interval_first(root); node != NULL; \
node = interval_next(node))
rotate->in_max_high = node->in_max_high;
left_max = node->in_left ? node->in_left->in_max_high : 0;
right_max = node->in_right ? node->in_right->in_max_high : 0;
- node->in_max_high = max_u64(interval_high(node),
- max_u64(left_max, right_max));
+ node->in_max_high = max3(interval_high(node),
+ left_max, right_max);
}
/* The left rotation "pivots" around the link from node to node->right, and
p = root;
while (*p) {
parent = *p;
- if (node_equal(parent, node))
- RETURN(parent);
/* max_high field must be updated after each iteration */
if (parent->in_max_high < interval_high(node))
while (node) {
left_max = node->in_left ? node->in_left->in_max_high : 0;
right_max = node->in_right ? node->in_right->in_max_high : 0;
- node->in_max_high = max_u64(interval_high(node),
- max_u64(left_max, right_max));
+ node->in_max_high = max3(interval_high(node),
+ left_max, right_max);
if (node->in_max_high >= old_maxhigh)
break;
* if (root == NULL)
* return res;
* if (root->in_max_high < low) {
- * res = max_u64(root->in_max_high + 1, res);
+ * res = max(root->in_max_high + 1, res);
* return res;
* } else if (low < interval_low(root)) {
* interval_expand_low(root->in_left, low);
* }
*
* if (interval_high(root) < low)
- * res = max_u64(interval_high(root) + 1, res);
+ * res = max(interval_high(root) + 1, res);
* interval_expand_low(root->in_left, low);
* interval_expand_low(root->in_right, low);
*