Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/seqc.h
Show All 30 Lines | |||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#endif | #endif | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
/* | /* | ||||
* seqc_t may be included in structs visible to userspace | * seqc_t may be included in structs visible to userspace | ||||
*/ | */ | ||||
typedef uint32_t seqc_t; | #include <sys/_seqc.h> | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
/* A hack to get MPASS macro */ | /* A hack to get MPASS macro */ | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <machine/cpu.h> | #include <machine/cpu.h> | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static __inline bool | static __inline bool | ||||
seqc_consistent(const seqc_t *seqcp, seqc_t oldseqc) | seqc_consistent(const seqc_t *seqcp, seqc_t oldseqc) | ||||
{ | { | ||||
atomic_thread_fence_acq(); | atomic_thread_fence_acq(); | ||||
return (seqc_consistent_nomb(seqcp, oldseqc)); | return (seqc_consistent_nomb(seqcp, oldseqc)); | ||||
} | |||||
/* | |||||
* Variant which does not critical enter/exit. | |||||
kib: So why not to make seqc_write_begin() call seqc_sleepable_write_begin() ?
And please split… | |||||
*/ | |||||
static __inline void | |||||
seqc_sleepable_write_begin(seqc_t *seqcp) | |||||
{ | |||||
MPASS(!seqc_in_modify(*seqcp)); | |||||
*seqcp += 1; | |||||
atomic_thread_fence_rel(); | |||||
} | |||||
static __inline void | |||||
seqc_sleepable_write_end(seqc_t *seqcp) | |||||
{ | |||||
atomic_thread_fence_rel(); | |||||
*seqcp += 1; | |||||
MPASS(!seqc_in_modify(*seqcp)); | |||||
} | } | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* _SYS_SEQC_H_ */ | #endif /* _SYS_SEQC_H_ */ |
So why not to make seqc_write_begin() call seqc_sleepable_write_begin() ?
And please split addition of _seqc.h, and seqc.h changes, separate commits.