Page MenuHomeFreeBSD

D28980.id84822.diff
No OneTemporary

D28980.id84822.diff

diff --git a/share/man/man9/VOP_RDWR.9 b/share/man/man9/VOP_RDWR.9
--- a/share/man/man9/VOP_RDWR.9
+++ b/share/man/man9/VOP_RDWR.9
@@ -83,6 +83,7 @@
.El
.Sh LOCKS
The file should be locked on entry and will still be locked on exit.
+Rangelock covering the whole i/o range should be owned around the call.
.Sh RETURN VALUES
Zero is returned on success, otherwise an error code is returned.
.Sh ERRORS
diff --git a/share/man/man9/VOP_READ_PGCACHE.9 b/share/man/man9/VOP_READ_PGCACHE.9
new file mode 100644
--- /dev/null
+++ b/share/man/man9/VOP_READ_PGCACHE.9
@@ -0,0 +1,108 @@
+.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This documentation was written by
+.\" Konstantin Belousov <kib@FreeBSD.org> 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 AUTHORS 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 AUTHORS 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 28, 2021
+.Dt VOP_READ_PGCACHE 9
+.Os
+.Sh NAME
+.Nm VOP_READ_PGCACHE
+.Nd read a file, fast
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/uio.h
+.Ft int
+.Fo VOP_READ_PGCACHE
+.Fa "struct vnode *vp"
+.Fa "struct uio *uio"
+.Fa "int ioflag"
+.Fa "struct ucred *cred"
+.Fc
+.Sh DESCRIPTION
+This entry point read the contents of a file.
+The intent is to provide the data from caches, which do not require
+expensive operations or any disk io.
+For instance, if filesystem uses normal VM page cache and maintains
+.Dv v_object
+lifetime, it can use
+.Xr vn_read_from_obj 9
+helper to return data from the resident
+.Dv vp->v_object
+pages.
+.Pp
+The filesystem indicates support for the
+.Nm
+on specific vnode by setting the
+.Dv VIRF_PGREAD
+flag in
+.Dv vp->v_irflag .
+.Pp
+The function does not need to satisfy the whole request, also it might choose
+to not provide any data.
+In these cases, the
+.Nm
+should return
+.Er EJUSTRETURN ,
+and VFS would handle the rest of the read operation using the
+.Xr VOP_READ 9 .
+.Pp
+The arguments are:
+.Bl -tag -width ioflag
+.It Fa vp
+The vnode of the file.
+.It Fa uio
+The location of the data to be read.
+.It Fa ioflag
+Various flags.
+.It Fa cnp
+The credentials of the caller.
+.El
+.Pp
+The
+.Nm
+does not handle non-zero
+.Fa ioflag
+argument.
+.Sh LOCKS
+The file should be referenced on entry on entry and will still be
+referenced on exit.
+Rangelock covering the whole read range should be owned around the call.
+.Sh RETURN VALUES
+Zero is returned on success, when the whole request is satisfied, and no
+more data cannot be provided for it by any means.
+If more data can be returned, but
+.Nm
+was unable to provide it,
+.Er EJUSTRETURN
+must be returned.
+Otherwise an error code is returned.
+.Sh SEE ALSO
+.Xr uiomove 9 ,
+.Xr vnode 9

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 29, 5:58 AM (13 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30513267
Default Alt Text
D28980.id84822.diff (3 KB)

Event Timeline