HomeFreeBSD

Use rw_tryupgrade() in dmu_bonus_hold_by_dnode()

Description

Use rw_tryupgrade() in dmu_bonus_hold_by_dnode()

When dn->dn_bonus == NULL, dmu_bonus_hold_by_dnode() will unlock its
read lock on dn->dn_struct_rwlock and grab a write lock. This can be
micro-optimized by calling rw_tryupgrade().

Linux will not benefit from this since it does not support rwlock
upgrades, but FreeBSD will.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14517

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Feb 23 2023, 12:33 AM
GitHub <noreply@github.com>Committed on Feb 23 2023, 12:33 AM
Parents
rGd9e64a4030d1: Improve error message of zfs redact
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rGc9e39da9a42a: Use rw_tryupgrade() in dmu_bonus_hold_by_dnode() (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Feb 23 2023, 12:33 AM