freebsd-nq/share/man/man9/vnode_pager_purge_range.9
Ka Ho Ng de2e152959 Add vnode_pager_purge_range(9) KPI
This KPI is created in addition to the existing vnode_pager_setsize(9)
KPI. The KPI is intended for file systems that are able to turn a range
of file into sparse range, also known as hole-punching.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D27194
2021-08-05 22:52:26 +08:00

86 lines
2.8 KiB
Groff

.\"
.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
.\"
.\" Copyright (c) 2021 The FreeBSD Foundation
.\"
.\" This manual page was written by Ka Ho Ng under sponsorship from
.\" the FreeBSD Foundation.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd August 2, 2021
.Dt VNODE_PAGER_PURGE_RANGE 9
.Os
.Sh NAME
.Nm vnode_pager_purge_range
.Nd "invalidate the cached contents within the given byte range"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_extern.h
.Ft void
.Fo vnode_pager_purge_range
.Fa "struct vnode *vp"
.Fa "vm_ooffset_t start"
.Fa "vm_ooffset_t end"
.Fc
.Sh DESCRIPTION
.Nm
invalidates the cached contents within the given byte range from the
specified vnode
.Fa vp .
The range to be purged is
.Eo [
.Fa start , end
.Ec ) .
If the
.Fa end
parameter is the value zero, the affected range starts from
.Fa start
continues to the end of the object.
Pages within the specified range will be removed from the object's queue.
If
.Fa start
or
.Fa end
is not aligned to a page boundary, the invalidated part of the page is zeroed.
This function only cleans the resident pages in the affected region, it is up to
the callers to ensure reading the backing store gets back zeroes.
.Pp
In case the vnode
.Fa vp
does not have a VM object allocated, the effect of calling this function is a
no-op.
.Sh LOCKS
The vnode must be locked on entry and will still be locked on exit.
.Sh SEE ALSO
.Xr vnode 9
.Sh HISTORY
The
.Nm
manual page first appeared in
.Fx 14 .
.Sh AUTHORS
This
manual page was written by
.An Ka Ho Ng Aq Mt khng@FreeBSD.org .