]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Use more atomics in refcounts
authorAlexander Motin <mav@FreeBSD.org>
Tue, 17 Aug 2021 15:44:34 +0000 (11:44 -0400)
committerTony Hutter <hutter2@llnl.gov>
Tue, 14 Sep 2021 21:31:01 +0000 (14:31 -0700)
commit5afc35b69824db01b36418e8f091ffeaeaeb98c9
tree87550992a8d5f8d743a25ac3c8c754ce6490d0fb
parentc6c0d30016ff344a91aacc8057d5fb392c5ea9c7
Use more atomics in refcounts

Use atomic_load_64() for zfs_refcount_count() to prevent torn reads
on 32-bit platforms.  On 64-bit ones it should not change anything.

When built with ZFS_DEBUG but running without tracking enabled use
atomics instead of mutexes same as for builds without ZFS_DEBUG.
Since rc_tracked can't change live we can check it without lock.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes #12420
include/sys/zfs_refcount.h
module/zfs/refcount.c