This source file includes following definitions.
- drbd_clear_interval
- drbd_interval_empty
1
2 #ifndef __DRBD_INTERVAL_H
3 #define __DRBD_INTERVAL_H
4
5 #include <linux/types.h>
6 #include <linux/rbtree.h>
7
8 struct drbd_interval {
9 struct rb_node rb;
10 sector_t sector;
11 unsigned int size;
12 sector_t end;
13 unsigned int local:1 ;
14 unsigned int waiting:1;
15 unsigned int completed:1;
16
17 };
18
19 static inline void drbd_clear_interval(struct drbd_interval *i)
20 {
21 RB_CLEAR_NODE(&i->rb);
22 }
23
24 static inline bool drbd_interval_empty(struct drbd_interval *i)
25 {
26 return RB_EMPTY_NODE(&i->rb);
27 }
28
29 extern bool drbd_insert_interval(struct rb_root *, struct drbd_interval *);
30 extern bool drbd_contains_interval(struct rb_root *, sector_t,
31 struct drbd_interval *);
32 extern void drbd_remove_interval(struct rb_root *, struct drbd_interval *);
33 extern struct drbd_interval *drbd_find_overlap(struct rb_root *, sector_t,
34 unsigned int);
35 extern struct drbd_interval *drbd_next_overlap(struct drbd_interval *, sector_t,
36 unsigned int);
37
38 #define drbd_for_each_overlap(i, root, sector, size) \
39 for (i = drbd_find_overlap(root, sector, size); \
40 i; \
41 i = drbd_next_overlap(i, sector, size))
42
43 #endif