diff options
Diffstat (limited to 'include/linux/seqlock.h')
-rw-r--r-- | include/linux/seqlock.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index 8cf350325dc6..cc359636cfa3 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h | |||
@@ -117,6 +117,22 @@ repeat: | |||
117 | } | 117 | } |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * raw_read_seqcount - Read the raw seqcount | ||
121 | * @s: pointer to seqcount_t | ||
122 | * Returns: count to be passed to read_seqcount_retry | ||
123 | * | ||
124 | * raw_read_seqcount opens a read critical section of the given | ||
125 | * seqcount without any lockdep checking and without checking or | ||
126 | * masking the LSB. Calling code is responsible for handling that. | ||
127 | */ | ||
128 | static inline unsigned raw_read_seqcount(const seqcount_t *s) | ||
129 | { | ||
130 | unsigned ret = ACCESS_ONCE(s->sequence); | ||
131 | smp_rmb(); | ||
132 | return ret; | ||
133 | } | ||
134 | |||
135 | /** | ||
120 | * raw_read_seqcount_begin - start seq-read critical section w/o lockdep | 136 | * raw_read_seqcount_begin - start seq-read critical section w/o lockdep |
121 | * @s: pointer to seqcount_t | 137 | * @s: pointer to seqcount_t |
122 | * Returns: count to be passed to read_seqcount_retry | 138 | * Returns: count to be passed to read_seqcount_retry |
@@ -218,6 +234,17 @@ static inline void raw_write_seqcount_end(seqcount_t *s) | |||
218 | } | 234 | } |
219 | 235 | ||
220 | /* | 236 | /* |
237 | * raw_write_seqcount_latch - redirect readers to even/odd copy | ||
238 | * @s: pointer to seqcount_t | ||
239 | */ | ||
240 | static inline void raw_write_seqcount_latch(seqcount_t *s) | ||
241 | { | ||
242 | smp_wmb(); /* prior stores before incrementing "sequence" */ | ||
243 | s->sequence++; | ||
244 | smp_wmb(); /* increment "sequence" before following stores */ | ||
245 | } | ||
246 | |||
247 | /* | ||
221 | * Sequence counter only version assumes that callers are using their | 248 | * Sequence counter only version assumes that callers are using their |
222 | * own mutexing. | 249 | * own mutexing. |
223 | */ | 250 | */ |