ZIL: Reduce scope of per-dataset zl_issuer_lock.
commitf63811f07213361d49878648bd597af88d06859c
authorAlexander Motin <mav@FreeBSD.org>
Thu, 25 May 2023 16:48:43 +0000 (25 12:48 -0400)
committerGitHub <noreply@github.com>
Thu, 25 May 2023 16:48:43 +0000 (25 09:48 -0700)
treefc7d387ebf8934ef69b2a99c512bfe416e0bd255
parent79b20949b25c8db4d379f6486b0835a6613b480c
ZIL: Reduce scope of per-dataset zl_issuer_lock.

Before this change ZIL copied all log data while holding the lock.
It caused huge lock contention on workloads with many big parallel
writes.  This change splits the process into two parts: first,
zil_lwb_assign() estimates the log space needed for all transactions,
and zil_lwb_write_close() allocates blocks and zios while holding the
lock, then, after the lock in dropped, zil_lwb_commit() copies the
data, and zil_lwb_write_issue() issues the I/Os.

Also while there slightly reduce scope of zl_lock.

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by:   iXsystems, Inc.
Closes #14841
include/sys/zil_impl.h
module/zfs/zil.c