| .. | .. |
|---|
| 13 | 13 | return this->end; |
|---|
| 14 | 14 | } |
|---|
| 15 | 15 | |
|---|
| 16 | | -/** |
|---|
| 17 | | - * compute_subtree_last - compute end of @node |
|---|
| 18 | | - * |
|---|
| 19 | | - * The end of an interval is the highest (start + (size >> 9)) value of this |
|---|
| 20 | | - * node and of its children. Called for @node and its parents whenever the end |
|---|
| 21 | | - * may have changed. |
|---|
| 22 | | - */ |
|---|
| 23 | | -static inline sector_t |
|---|
| 24 | | -compute_subtree_last(struct drbd_interval *node) |
|---|
| 25 | | -{ |
|---|
| 26 | | - sector_t max = node->sector + (node->size >> 9); |
|---|
| 16 | +#define NODE_END(node) ((node)->sector + ((node)->size >> 9)) |
|---|
| 27 | 17 | |
|---|
| 28 | | - if (node->rb.rb_left) { |
|---|
| 29 | | - sector_t left = interval_end(node->rb.rb_left); |
|---|
| 30 | | - if (left > max) |
|---|
| 31 | | - max = left; |
|---|
| 32 | | - } |
|---|
| 33 | | - if (node->rb.rb_right) { |
|---|
| 34 | | - sector_t right = interval_end(node->rb.rb_right); |
|---|
| 35 | | - if (right > max) |
|---|
| 36 | | - max = right; |
|---|
| 37 | | - } |
|---|
| 38 | | - return max; |
|---|
| 39 | | -} |
|---|
| 40 | | - |
|---|
| 41 | | -RB_DECLARE_CALLBACKS(static, augment_callbacks, struct drbd_interval, rb, |
|---|
| 42 | | - sector_t, end, compute_subtree_last); |
|---|
| 18 | +RB_DECLARE_CALLBACKS_MAX(static, augment_callbacks, |
|---|
| 19 | + struct drbd_interval, rb, sector_t, end, NODE_END); |
|---|
| 43 | 20 | |
|---|
| 44 | 21 | /** |
|---|
| 45 | 22 | * drbd_insert_interval - insert a new interval into a tree |
|---|