summaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2014-09-18 16:49:42 +0200
committerJens Axboe <axboe@fb.com>2014-09-18 09:00:17 -0600
commite9f05b4cfed38d0e57b0a705a7f480cfbe0c3247 (patch)
tree9b0a98ac1bb1cc83947c5b9843ab72f89a8644ac /drivers/block/drbd
parent82cfb90bc99d7b7e0ec62d0505b9d4f06805d5db (diff)
downloadlinux-stable-e9f05b4cfed38d0e57b0a705a7f480cfbe0c3247.tar.gz
linux-stable-e9f05b4cfed38d0e57b0a705a7f480cfbe0c3247.tar.bz2
linux-stable-e9f05b4cfed38d0e57b0a705a7f480cfbe0c3247.zip
drbd: use RB_DECLARE_CALLBACKS() to define augment callbacks
The original code are the same as RB_DECLARE_CALLBACKS(). CC: Michel Lespinasse <walken@google.com> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Andreas Gruenbacher <agruen@linbit.com> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r--drivers/block/drbd/drbd_interval.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/drivers/block/drbd/drbd_interval.c b/drivers/block/drbd/drbd_interval.c
index 04a14e0f8878..51b25ad85251 100644
--- a/drivers/block/drbd/drbd_interval.c
+++ b/drivers/block/drbd/drbd_interval.c
@@ -37,40 +37,8 @@ compute_subtree_last(struct drbd_interval *node)
return max;
}
-static void augment_propagate(struct rb_node *rb, struct rb_node *stop)
-{
- while (rb != stop) {
- struct drbd_interval *node = rb_entry(rb, struct drbd_interval, rb);
- sector_t subtree_last = compute_subtree_last(node);
- if (node->end == subtree_last)
- break;
- node->end = subtree_last;
- rb = rb_parent(&node->rb);
- }
-}
-
-static void augment_copy(struct rb_node *rb_old, struct rb_node *rb_new)
-{
- struct drbd_interval *old = rb_entry(rb_old, struct drbd_interval, rb);
- struct drbd_interval *new = rb_entry(rb_new, struct drbd_interval, rb);
-
- new->end = old->end;
-}
-
-static void augment_rotate(struct rb_node *rb_old, struct rb_node *rb_new)
-{
- struct drbd_interval *old = rb_entry(rb_old, struct drbd_interval, rb);
- struct drbd_interval *new = rb_entry(rb_new, struct drbd_interval, rb);
-
- new->end = old->end;
- old->end = compute_subtree_last(old);
-}
-
-static const struct rb_augment_callbacks augment_callbacks = {
- augment_propagate,
- augment_copy,
- augment_rotate,
-};
+RB_DECLARE_CALLBACKS(static, augment_callbacks, struct drbd_interval, rb,
+ sector_t, end, compute_subtree_last);
/**
* drbd_insert_interval - insert a new interval into a tree