| VOP_GETPAGES(9) | Kernel Developer's Manual | VOP_GETPAGES(9) | 
VOP_GETPAGES,
    VOP_PUTPAGES — read or write
    VM pages from a file
#include
    <sys/param.h>
  
  #include <sys/vnode.h>
  
  #include <vm/vm.h>
int
  
  VOP_GETPAGES(struct vnode *vp,
    vm_page_t *ma, int count,
    int *rbehind, int *rahead);
int
  
  VOP_PUTPAGES(struct vnode *vp,
    vm_page_t *ma, int bytecount,
    int flags, int *rtvals);
The
    VOP_GETPAGES()
    method is called to read in pages of virtual memory which are backed by
    ordinary files. If other adjacent pages are backed by adjacent regions of
    the same file, VOP_GETPAGES() is requested to read
    those pages as well, although it is not required to do so. The
    VOP_PUTPAGES() method does the converse; that is to
    say, it writes out adjacent dirty pages of virtual memory.
On entry, the vnode lock is held but neither the page queue nor VM object locks are held. Both methods return in the same state on both success and error returns.
The arguments are:
VM_PAGER_PUT_SYNC is set, the write should be
      synchronous; control must not be returned to the caller until after the
      write is finished. If VM_PAGER_PUT_INVAL is set,
      the pages are to be invalidated after being written. If
      VM_PAGER_PUT_NOREUSE is set, the I/O performed
      should set the IO_NOREUSE flag, to indicate to the filesystem that pages
      should be marked for fast reuse if needed. This could occur via a call to
      vm_page_deactivate_noreuse(9), which puts such pages
      onto the head of the inactive queue. If
      VM_PAGER_CLUSTER_OK is set, writes may be delayed,
      so that related writes can be coalesced for efficiency, e.g., using the
      clustering mechanism of the buffer cache.VOP_PUTPAGES().The status of the
    VOP_PUTPAGES()
    method is returned on a page-by-page basis in the array
    rtvals[]. The possible status values are as
  follows:
VM_PAGER_OKVM_PAGER_PENDVM_PAGER_BADVM_PAGER_ERRORVM_PAGER_FAILVM_PAGER_ERROR.VM_PAGER_AGAINThe
    VOP_GETPAGES()
    method must populate and validate all requested pages in order to return
    success. It is expected to release any pages in ma
    that it does not successfully handle, by calling
    vm_page_free(9). When it succeeds,
    VOP_GETPAGES() must set the valid bits
    appropriately. Upon entry to VOP_GETPAGES(), all
    pages in ma are busied exclusively. Upon successful
    return, the pages must all be busied exclusively as well, but pages may be
    unbusied during processing. The filesystem is responsible for activating
    paged-out pages, but this does not necessarily need to be done within
    VOP_GETPAGES() depending on the architecture of the
    particular filesystem.
If it successfully reads all pages in ma,
    VOP_GETPAGES() returns
    VM_PAGER_OK; otherwise, it returns
    VM_PAGER_ERROR. By convention, the return value of
    VOP_PUTPAGES() is
  rtvals[0].
vm_object_pip_wakeup(9), vm_page_free(9), vm_page_sunbusy(9), vm_page_undirty(9), vm_page_xunbusy(9), vnode(9)
This manual page was written by Doug
    Rabson and then substantially rewritten by
  
  Garrett Wollman.
| June 29, 2019 | Debian |