Whamcloud - gitweb
LU-17662 osd-zfs: Support for ZFS 2.2.3
[fs/lustre-release.git] / lustre / obdclass / interval_tree.c
index 1a9d897..aa79775 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * lustre/ldlm/interval_tree.c
  *
@@ -106,21 +105,6 @@ static inline int node_compare(struct interval_node *n1,
        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))
@@ -251,8 +235,8 @@ static void __rotate_change_maxhigh(struct interval_node *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
@@ -394,8 +378,6 @@ struct interval_node *interval_insert(struct interval_node *node,
        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))
@@ -520,8 +502,8 @@ static void update_maxhigh(struct interval_node *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;
@@ -720,7 +702,7 @@ EXPORT_SYMBOL(interval_is_overlapped);
  *        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);
@@ -728,7 +710,7 @@ EXPORT_SYMBOL(interval_is_overlapped);
  *        }
  *
  *        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);
  *