This source file includes following definitions.
- u64_stats_init
- u64_stats_update_begin
- u64_stats_update_end
- u64_stats_update_begin_irqsave
- u64_stats_update_end_irqrestore
- __u64_stats_fetch_begin
- u64_stats_fetch_begin
- __u64_stats_fetch_retry
- u64_stats_fetch_retry
- u64_stats_fetch_begin_irq
- u64_stats_fetch_retry_irq
1
2 #ifndef _LINUX_U64_STATS_SYNC_H
3 #define _LINUX_U64_STATS_SYNC_H
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 #include <linux/seqlock.h>
64
65 struct u64_stats_sync {
66 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
67 seqcount_t seq;
68 #endif
69 };
70
71
72 static inline void u64_stats_init(struct u64_stats_sync *syncp)
73 {
74 #if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
75 seqcount_init(&syncp->seq);
76 #endif
77 }
78
79 static inline void u64_stats_update_begin(struct u64_stats_sync *syncp)
80 {
81 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
82 write_seqcount_begin(&syncp->seq);
83 #endif
84 }
85
86 static inline void u64_stats_update_end(struct u64_stats_sync *syncp)
87 {
88 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
89 write_seqcount_end(&syncp->seq);
90 #endif
91 }
92
93 static inline unsigned long
94 u64_stats_update_begin_irqsave(struct u64_stats_sync *syncp)
95 {
96 unsigned long flags = 0;
97
98 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
99 local_irq_save(flags);
100 write_seqcount_begin(&syncp->seq);
101 #endif
102 return flags;
103 }
104
105 static inline void
106 u64_stats_update_end_irqrestore(struct u64_stats_sync *syncp,
107 unsigned long flags)
108 {
109 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
110 write_seqcount_end(&syncp->seq);
111 local_irq_restore(flags);
112 #endif
113 }
114
115 static inline unsigned int __u64_stats_fetch_begin(const struct u64_stats_sync *syncp)
116 {
117 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
118 return read_seqcount_begin(&syncp->seq);
119 #else
120 return 0;
121 #endif
122 }
123
124 static inline unsigned int u64_stats_fetch_begin(const struct u64_stats_sync *syncp)
125 {
126 #if BITS_PER_LONG==32 && !defined(CONFIG_SMP)
127 preempt_disable();
128 #endif
129 return __u64_stats_fetch_begin(syncp);
130 }
131
132 static inline bool __u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
133 unsigned int start)
134 {
135 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
136 return read_seqcount_retry(&syncp->seq, start);
137 #else
138 return false;
139 #endif
140 }
141
142 static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
143 unsigned int start)
144 {
145 #if BITS_PER_LONG==32 && !defined(CONFIG_SMP)
146 preempt_enable();
147 #endif
148 return __u64_stats_fetch_retry(syncp, start);
149 }
150
151
152
153
154
155
156
157 static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *syncp)
158 {
159 #if BITS_PER_LONG==32 && !defined(CONFIG_SMP)
160 local_irq_disable();
161 #endif
162 return __u64_stats_fetch_begin(syncp);
163 }
164
165 static inline bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *syncp,
166 unsigned int start)
167 {
168 #if BITS_PER_LONG==32 && !defined(CONFIG_SMP)
169 local_irq_enable();
170 #endif
171 return __u64_stats_fetch_retry(syncp, start);
172 }
173
174 #endif