mirror_zfs/include/os/freebsd/spl/sys
Rob Norris 3b64a9619f FreeBSD: zfs_putpages: don't undirty pages until after write completes
In syncing mode, zfs_putpages() would put the entire range of pages onto
the ZIL, then return VM_PAGER_OK for each page to the kernel. However,
an associated zil_commit() or txg sync had not happened at this point,
so the write may not actually be on disk.

So, we rework that case to use a ZIL commit callback, and do the
post-write work of undirtying the page and signaling completion there.
We return VM_PAGER_PEND to the kernel instead so it knows that we will
take care of it.

The original version of this (238eab7dc1) copied the Linux model and did
the cleanup in a ZIL callback for both async and sync. This was a
mistake, as FreeBSD does not have a separate "busy for writeback" flag
like Linux which keeps the page usable. The full sbusy flag locks the
entire page out until the itx callback fires, which for async is after
txg sync, which could be literal seconds in the future.

For the async case, the data is already on the DMU and the in-memory
ZIL, which is sufficient for async writeback, so the old method of
logging it without a callback, undirtying the page and returning is more
than sufficient and reclaims that lost performance.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Mark Johnston <markj@FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #17533
2025-08-12 22:41:17 -04:00
..
ia32 SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
acl_impl.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
acl.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
atomic.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
byteorder.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
callb.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
ccompat.h freebsd: Use compiler.h from FreeBSD's base's linuxkpi 2024-10-21 13:02:07 -07:00
ccompile.h tunables: remove FreeBSD compat macros for Linux module params 2025-06-17 10:50:26 -07:00
cmn_err.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
condvar.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
cred.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
ctype.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
debug.h Cleanup VERIFY() macros (#17163) 2025-05-28 16:00:28 -07:00
dirent.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
disp.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
fcntl.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
file.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
freebsd_rwlock.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
idmap.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
inttypes.h Add FreeBSD support to OpenZFS 2020-04-14 11:36:28 -07:00
isa_defs.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
kmem_cache.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
kmem.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
kstat.h SPDX: license tags: GPL-2.0-or-later 2025-04-16 09:59:44 -07:00
list_impl.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
list.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
lock.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
misc.h Skip dbuf_evict_one() from dbuf_evict_notify() for reclaim thread 2025-08-07 12:15:14 -04:00
mod_os.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
mode.h Add FreeBSD support to OpenZFS 2020-04-14 11:36:28 -07:00
mount.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
mutex.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
param.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
policy.h cred: properly pass and test creds on other threads (#17273) 2025-05-28 16:00:28 -07:00
proc.h spa: ZIO_TASKQ_ISSUE: Use symbolic priority 2025-08-12 17:16:00 -07:00
processor.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
procfs_list.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
random.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
rwlock.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
sdt.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
sid.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
sig.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
simd_aarch64.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
simd_arm.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
simd_powerpc.h simd_powerpc.h: enable FPU on FreeBSD 2025-04-16 09:59:45 -07:00
simd_x86.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
simd.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
spl_condvar.h FreeBSD: Reduce divergence from in-tree sources 2023-10-09 13:27:18 -07:00
string.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
sunddi.h SPDX: license tags: GPL-2.0-or-later 2025-04-16 09:59:44 -07:00
sysmacros.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
systeminfo.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
systm.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
taskq.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
thread.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
time.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
timer.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
trace_zfs.h Add FreeBSD support to OpenZFS 2020-04-14 11:36:28 -07:00
trace.h Add FreeBSD support to OpenZFS 2020-04-14 11:36:28 -07:00
types32.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
types.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
uio.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
uuid.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
vfs.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
vm.h FreeBSD: zfs_putpages: don't undirty pages until after write completes 2025-08-12 22:41:17 -04:00
vmsystm.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
vnode_impl.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
vnode.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00
wmsum.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
zmod.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
zone.h SPDX: license tags: BSD-2-Clause 2025-04-16 09:59:44 -07:00