atomic: make atomic_store_ptr type-aware
This commit is contained in:
parent
f40d6217f2
commit
cc96f92a57
@ -444,7 +444,7 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
|
||||
zp->z_blksz = blksz;
|
||||
zp->z_seq = 0x7A4653;
|
||||
zp->z_sync_cnt = 0;
|
||||
atomic_store_ptr((uintptr_t *)&zp->z_cached_symlink, (uintptr_t)NULL);
|
||||
atomic_store_ptr(&zp->z_cached_symlink, NULL);
|
||||
|
||||
vp = ZTOV(zp);
|
||||
|
||||
|
@ -360,8 +360,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type,
|
||||
* TODO: Since there is no load consume primitive provided
|
||||
* right now, the load is performed with an acquire fence.
|
||||
*/
|
||||
atomic_store_ptr((uintptr_t *)&nnode->tn_link_target,
|
||||
(uintptr_t)symlink);
|
||||
atomic_store_ptr(&nnode->tn_link_target, symlink);
|
||||
atomic_store_char((char *)&nnode->tn_link_smr, symlink_smr);
|
||||
atomic_thread_fence_rel();
|
||||
break;
|
||||
@ -453,8 +452,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node,
|
||||
|
||||
case VLNK:
|
||||
symlink = node->tn_link_target;
|
||||
atomic_store_ptr((uintptr_t *)&node->tn_link_target,
|
||||
(uintptr_t)NULL);
|
||||
atomic_store_ptr(&node->tn_link_target, NULL);
|
||||
if (atomic_load_char(&node->tn_link_smr)) {
|
||||
cache_symlink_free(symlink, node->tn_size + 1);
|
||||
} else {
|
||||
|
@ -243,7 +243,10 @@ void kcsan_atomic_thread_fence_seq_cst(void);
|
||||
#define atomic_subtract_ptr kcsan_atomic_subtract_ptr
|
||||
#define atomic_subtract_acq_ptr kcsan_atomic_subtract_acq_ptr
|
||||
#define atomic_subtract_rel_ptr kcsan_atomic_subtract_rel_ptr
|
||||
#define atomic_store_ptr kcsan_atomic_store_ptr
|
||||
#define atomic_store_ptr(x, v) ({ \
|
||||
__typeof(*x) __value = (v); \
|
||||
kcsan_atomic_store_ptr((volatile uintptr_t *)(x), (uintptr_t)(__value));\
|
||||
})
|
||||
#define atomic_store_rel_ptr kcsan_atomic_store_rel_ptr
|
||||
#define atomic_swap_ptr kcsan_atomic_swap_ptr
|
||||
#define atomic_testandclear_ptr kcsan_atomic_testandclear_ptr
|
||||
|
@ -58,7 +58,7 @@
|
||||
#define atomic_store_long(p, v) \
|
||||
(*(volatile u_long *)(p) = (u_long)(v))
|
||||
#define atomic_store_ptr(p, v) \
|
||||
(*(volatile uintptr_t *)(p) = (uintptr_t)(v))
|
||||
(*(volatile __typeof(*p) *)(p) = (v))
|
||||
#define atomic_store_8(p, v) \
|
||||
(*(volatile uint8_t *)(p) = (uint8_t)(v))
|
||||
#define atomic_store_16(p, v) \
|
||||
|
Loading…
Reference in New Issue
Block a user