This source file includes following definitions.
- cond_wake_up
- cond_wake_up_nomb
- div_factor
- div_factor_fine
1
2
3 #ifndef BTRFS_MISC_H
4 #define BTRFS_MISC_H
5
6 #include <linux/sched.h>
7 #include <linux/wait.h>
8 #include <asm/div64.h>
9
10 #define in_range(b, first, len) ((b) >= (first) && (b) < (first) + (len))
11
12 static inline void cond_wake_up(struct wait_queue_head *wq)
13 {
14
15
16
17
18 if (wq_has_sleeper(wq))
19 wake_up(wq);
20 }
21
22 static inline void cond_wake_up_nomb(struct wait_queue_head *wq)
23 {
24
25
26
27
28
29
30 if (waitqueue_active(wq))
31 wake_up(wq);
32 }
33
34 static inline u64 div_factor(u64 num, int factor)
35 {
36 if (factor == 10)
37 return num;
38 num *= factor;
39 return div_u64(num, 10);
40 }
41
42 static inline u64 div_factor_fine(u64 num, int factor)
43 {
44 if (factor == 100)
45 return num;
46 num *= factor;
47 return div_u64(num, 100);
48 }
49
50 #endif