]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
ZFS: add emulation of atomic_swap_64 and atomic_load_64
authoravg <avg@FreeBSD.org>
Mon, 7 Oct 2019 07:54:34 +0000 (07:54 +0000)
committeravg <avg@FreeBSD.org>
Mon, 7 Oct 2019 07:54:34 +0000 (07:54 +0000)
commit3458e5d1e6354123ec2b0953d29f98126aa442e6
treee3b10ad58a423452e372a9c9fa58163fee2f8e10
parent87b704d0e37af47d551d1c48220efe062ae9f186
ZFS: add emulation of atomic_swap_64 and atomic_load_64

Some 32-bit platforms do not provide 64-bit atomic operations that ZFS
requires, either in userland or at all.  We emulate those operations for
those platforms using a mutex.  That is not entirely correct and it's
very efficient.  Besides, the loads are plain loads, so torn values are
possible.

Nevertheless, the emulation seems to work for some definition of work.

This change adds atomic_swap_64, which is already used in ZFS code, and
atomic_load_64 that can be used to prevent torn reads.

MFC after: 1 week
sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
sys/cddl/compat/opensolaris/sys/atomic.h