HomeFreeBSD

ZFS: add emulation of atomic_swap_64 and atomic_load_64

Description

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

Details

Provenance
avgAuthored on
Parents
rS353166: add atomic_load_64 for mipsn32
Branches
Unknown
Tags
Unknown