1 .\" Copyright (c) 2021 The FreeBSD Foundation, Inc.
3 .\" This documentation was written by
4 .\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
5 .\" from the FreeBSD Foundation.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .Dt VOP_READ_PGCACHE 9
42 .Fa "struct vnode *vp"
45 .Fa "struct ucred *cred"
48 This entry point reads the contents of a file.
49 The intent is to provide the data from caches, which do not require
50 expensive operations or any disk IO.
51 For instance, if filesystem uses normal VM page cache and maintains
54 .Xr vn_read_from_obj 9
55 helper to return data from the resident
59 The filesystem indicates support for the
61 on specific vnode by setting the
66 The function does not need to satisfy the whole request; it also might choose
67 to not provide any data.
70 must be advanced by the amount of read data,
74 and VFS would handle the rest of the read operation using the
77 The VFS layer does the same deadlock avoidance for accessing userspace
83 Vnode is not locked on the call entry and should not be locked on return.
84 For a filesystem that requires vnode lock to return any data, it does
85 not make sense to implement
89 flag) since VFS arranges the call to
94 .Bl -tag -width ioflag
96 The vnode of the file.
98 The location of the data to be read.
104 The credentials of the caller.
108 does not handle non-zero
112 The file should be referenced on entry on entry and will still be
114 Rangelock covering the whole read range should be owned around the call.
116 Zero is returned on success, when the whole request is satisfied, and no
117 more data cannot be provided for it by any means.
118 If more data can be returned, but
120 was unable to provide it,
125 records should be updated according to the partial operation done.
127 Otherwise an error code is returned,