3 .\" Copyright (c) 1996 Doug Rabson
4 .\" Copyright 2003, Garrett A. Wollman
6 .\" All rights reserved.
8 .\" This program is free software.
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
19 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
20 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 .Nd read or write VM pages from a file
44 .Fn VOP_GETPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int *rbehind" "int *rahead"
46 .Fn VOP_PUTPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int sync" "int *rtvals"
50 method is called to read in pages of virtual memory which are backed by
52 If other adjacent pages are backed by adjacent regions of the same file,
54 is requested to read those pages as well, although it is not required to
58 method does the converse; that is to say, it writes out adjacent dirty
59 pages of virtual memory.
61 On entry, the vnode lock is held but neither the page queue nor VM object
63 Both methods return in the same state on both success and error returns.
66 .Bl -tag -width rbehind
70 Pointer to the first element of an array of pages representing a
71 contiguous region of the file to be read or written.
73 The number of bytes that should be read into the pages of the array.
76 if the write should be synchronous.
78 An array of VM system result codes indicating the status of each
82 Optional pointer to integer specifying number of pages to be read behind, if
84 If the filesystem supports that feature, number of actually read pages is
85 reported back, otherwise zero is returned.
87 Optional pointer to integer specifying number of pages to be read ahead, if
89 If the filesystem supports that feature, number of actually read pages is
90 reported back, otherwise zero is returned.
95 method is returned on a page-by-page basis in the array
97 The possible status values are as follows:
98 .Bl -tag -width VM_PAGER_ERROR
100 The page was successfully written.
101 The implementation must call
102 .Xr vm_page_undirty 9
103 to mark the page as clean.
105 The page was scheduled to be written asynchronously.
106 When the write completes, the completion callback should
108 .Xr vm_object_pip_wakeup 9
110 .Xr vm_page_sunbusy 9
111 to clear the busy flag and awaken any other threads waiting for this page,
112 in addition to calling
113 .Xr vm_page_undirty 9 .
115 The page was entirely beyond the end of the backing file.
116 This condition should not be possible if the vnode's file system
117 is correctly implemented.
118 .It Dv VM_PAGER_ERROR
119 The page could not be written because of an error on the underlying storage
122 Treated identically to
124 .It Dv VM_PAGER_AGAIN
125 The page was not handled by this request.
130 method is expected to release any pages in
132 that it does not successfully handle, by calling
136 must set the valid bits appropriately.
141 It must unbusy all other successfully handled pages and put them
142 on appropriate page queue(s).
145 may either activate a page (if its wanted bit is set)
146 or deactivate it (otherwise), and finally call
147 .Xr vm_page_xunbusy 9
148 to arouse any threads currently waiting for the page to be faulted in.
150 If it successfully reads
157 By convention, the return value of
162 .Xr vm_object_pip_wakeup 9 ,
164 .Xr vm_page_sunbusy 9 ,
165 .Xr vm_page_undirty 9 ,
166 .Xr vm_page_xunbusy 9 ,
169 This manual page was written by
171 and then substantially rewritten by
172 .An Garrett Wollman .