[media] stb0899: use sign_extend32() for sign extension
[linux/fpc-iii.git] / drivers / block / drbd / drbd_interval.h
blobf210543f05f4782674de8abb0b0053e0e4833bfb
1 #ifndef __DRBD_INTERVAL_H
2 #define __DRBD_INTERVAL_H
4 #include <linux/types.h>
5 #include <linux/rbtree.h>
7 struct drbd_interval {
8 struct rb_node rb;
9 sector_t sector; /* start sector of the interval */
10 unsigned int size; /* size in bytes */
11 sector_t end; /* highest interval end in subtree */
12 int local:1 /* local or remote request? */;
13 int waiting:1; /* someone is waiting for this to complete */
14 int completed:1; /* this has been completed already;
15 * ignore for conflict detection */
18 static inline void drbd_clear_interval(struct drbd_interval *i)
20 RB_CLEAR_NODE(&i->rb);
23 static inline bool drbd_interval_empty(struct drbd_interval *i)
25 return RB_EMPTY_NODE(&i->rb);
28 extern bool drbd_insert_interval(struct rb_root *, struct drbd_interval *);
29 extern bool drbd_contains_interval(struct rb_root *, sector_t,
30 struct drbd_interval *);
31 extern void drbd_remove_interval(struct rb_root *, struct drbd_interval *);
32 extern struct drbd_interval *drbd_find_overlap(struct rb_root *, sector_t,
33 unsigned int);
34 extern struct drbd_interval *drbd_next_overlap(struct drbd_interval *, sector_t,
35 unsigned int);
37 #define drbd_for_each_overlap(i, root, sector, size) \
38 for (i = drbd_find_overlap(root, sector, size); \
39 i; \
40 i = drbd_next_overlap(i, sector, size))
42 #endif /* __DRBD_INTERVAL_H */