]> granicus.if.org Git - zfs/commit
Decrease contention on dn_struct_rwlock
authorPaul Dagnelie <pcd@delphix.com>
Mon, 8 Jul 2019 20:18:50 +0000 (13:18 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 8 Jul 2019 20:18:50 +0000 (13:18 -0700)
commitf664f1ee7fc9dd7101171f6518c67951cb5bd8cf
tree790db3e84a6edf3bd67b1869cd81f3b312d06ba7
parentcb709642216b5ac9be10039471c3c4bc27cb7cf2
Decrease contention on dn_struct_rwlock

Currently, sequential async write workloads spend a lot of time
contending on the dn_struct_rwlock. This lock is responsible for
protecting the entire block tree below it; this naturally results
in some serialization during heavy write workloads. This can be
resolved by having per-dbuf locking, which will allow multiple
writers in the same object at the same time.

We introduce a new rwlock, the db_rwlock. This lock is responsible
for protecting the contents of the dbuf that it is a part of; when
reading a block pointer from a dbuf, you hold the lock as a reader.
When writing data to a dbuf, you hold it as a writer. This allows
multiple threads to write to different parts of a file at the same
time.

Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Reviewed by: Matt Ahrens matt@delphix.com
Reviewed by: George Wilson george.wilson@delphix.com
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
External-issue: DLPX-52564
External-issue: DLPX-53085
External-issue: DLPX-57384
Closes #8946
include/sys/dbuf.h
include/sys/dmu_zfetch.h
module/zfs/dbuf.c
module/zfs/dmu.c
module/zfs/dmu_zfetch.c
module/zfs/dnode.c
module/zfs/dnode_sync.c