ZAP: Massively switch to _by_dnode() interfaces
commit80cc516295fef1a429542fcfeea369c6bbb85ce4
authorAlexander Motin <mav@FreeBSD.org>
Mon, 25 Mar 2024 21:58:50 +0000 (25 17:58 -0400)
committerGitHub <noreply@github.com>
Mon, 25 Mar 2024 21:58:50 +0000 (25 14:58 -0700)
tree30b9d9df590252a12821f43d9de500a8253b51cd
parentbf8f72359d1bf0cdb6a4b31ccfc7bbef0f948ca4
ZAP: Massively switch to _by_dnode() interfaces

Before this change ZAP called dnode_hold() for almost every block
access, that was clearly visible in profiler under heavy load, such
as BRT.  This patch makes it always hold the dnode reference between
zap_lockdir() and zap_unlockdir().  It allows to avoid most of dnode
operations between those.  It also adds several new _by_dnode() APIs
to ZAP and uses them in BRT code.  Also adds dmu_prefetch_by_dnode()
variant and uses it in the ZAP code.

After this there remains only one call to dmu_buf_dnode_enter(),
which seems to be unneeded.  So remove the call and the functions.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15951
include/sys/dmu.h
include/sys/zap.h
include/sys/zap_impl.h
module/zfs/brt.c
module/zfs/dbuf.c
module/zfs/dmu.c
module/zfs/dmu_recv.c
module/zfs/zap.c
module/zfs/zap_micro.c