]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Introduce dsl_dir_diduse_transfer_space()
authorAlexander Motin <mav@FreeBSD.org>
Fri, 16 Jul 2021 19:39:24 +0000 (15:39 -0400)
committerTony Hutter <hutter2@llnl.gov>
Tue, 14 Sep 2021 19:38:51 +0000 (12:38 -0700)
commitba76bb30a697d84c18de47d1ffd578b04b51df56
treed8c2217a82332ad301245429f602593191ba08c3
parent968dc135728dcc9d4919b57408049a4d8bfcdfc2
Introduce dsl_dir_diduse_transfer_space()

Most of dsl_dir_diduse_space() and dsl_dir_transfer_space() CPU time
is a dd_lock overhead and time spent in dmu_buf_will_dirty(). Calling
them one after another is a waste of time and even more contention.
Doing that twice for each rewritten block within dbuf_write_done()
via dsl_dataset_block_kill() and dsl_dataset_block_born() created one
of the biggest CPU overheads in case of small blocks rewrite.

dsl_dir_diduse_transfer_space() combines functionality of these two
functions for cases where it is needed, but without double overhead,
practically for the cost of dsl_dir_diduse_space() or even cheaper.

While there, optimize dsl_dir_phys() calls in dsl_dir_diduse_space()
and dsl_dir_transfer_space().  It seems Clang detects some aliasing
there, repeating dd->dd_dbuf->db_data dereference multiple times,
increasing dd_lock scope and contention.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Author: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes #12300
include/sys/dsl_dir.h
module/zfs/dsl_dataset.c
module/zfs/dsl_dir.c