Rev 6934 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6934 | Rev 6936 | ||
---|---|---|---|
Line 232... | Line 232... | ||
232 | { |
232 | { |
233 | smp_wmb(); |
233 | smp_wmb(); |
234 | s->sequence++; |
234 | s->sequence++; |
235 | } |
235 | } |
Line -... | Line 236... | ||
- | 236 | ||
- | 237 | /** |
|
- | 238 | * raw_write_seqcount_barrier - do a seq write barrier |
|
- | 239 | * @s: pointer to seqcount_t |
|
- | 240 | * |
|
- | 241 | * This can be used to provide an ordering guarantee instead of the |
|
- | 242 | * usual consistency guarantee. It is one wmb cheaper, because we can |
|
- | 243 | * collapse the two back-to-back wmb()s. |
|
- | 244 | * |
|
- | 245 | * seqcount_t seq; |
|
- | 246 | * bool X = true, Y = false; |
|
- | 247 | * |
|
- | 248 | * void read(void) |
|
- | 249 | * { |
|
- | 250 | * bool x, y; |
|
- | 251 | * |
|
- | 252 | * do { |
|
- | 253 | * int s = read_seqcount_begin(&seq); |
|
- | 254 | * |
|
- | 255 | * x = X; y = Y; |
|
- | 256 | * |
|
- | 257 | * } while (read_seqcount_retry(&seq, s)); |
|
- | 258 | * |
|
- | 259 | * BUG_ON(!x && !y); |
|
- | 260 | * } |
|
- | 261 | * |
|
- | 262 | * void write(void) |
|
- | 263 | * { |
|
- | 264 | * Y = true; |
|
- | 265 | * |
|
- | 266 | * raw_write_seqcount_barrier(seq); |
|
- | 267 | * |
|
- | 268 | * X = false; |
|
- | 269 | * } |
|
- | 270 | */ |
|
- | 271 | static inline void raw_write_seqcount_barrier(seqcount_t *s) |
|
- | 272 | { |
|
- | 273 | s->sequence++; |
|
- | 274 | smp_wmb(); |
|
- | 275 | s->sequence++; |
|
- | 276 | } |
|
- | 277 | ||
- | 278 | static inline int raw_read_seqcount_latch(seqcount_t *s) |
|
- | 279 | { |
|
- | 280 | return lockless_dereference(s->sequence); |
|
- | 281 | } |
|
236 | 282 | ||
237 | /* |
283 | /** |
238 | * raw_write_seqcount_latch - redirect readers to even/odd copy |
284 | * raw_write_seqcount_latch - redirect readers to even/odd copy |
239 | * @s: pointer to seqcount_t |
285 | * @s: pointer to seqcount_t |
240 | * |
286 | * |
241 | * The latch technique is a multiversion concurrency control method that allows |
287 | * The latch technique is a multiversion concurrency control method that allows |