1.\" 2.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice(s), this list of conditions and the following disclaimer as 9.\" the first lines of this file unmodified other than the possible 10.\" addition of one or more copyright notices. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice(s), this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 16.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 19.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 25.\" DAMAGE. 26.\" 27.\" $FreeBSD$ 28.\" 29.Dd December 1, 2001 30.Dt VM_PAGE_BITS 9 31.Os 32.Sh NAME 33.Nm vm_page_bits , 34.Nm vm_page_set_validclean , 35.Nm vm_page_clear_dirty , 36.Nm vm_page_set_invalid , 37.Nm vm_page_zero_invalid , 38.Nm vm_page_is_valid , 39.Nm vm_page_test_dirty , 40.Nm vm_page_dirty , 41.Nm vm_page_undirty 42.Nd "manage page clean and dirty bits" 43.Sh SYNOPSIS 44.In sys/param.h 45.In vm/vm.h 46.In vm/vm_page.h 47.Ft int 48.Fn vm_page_bits "int base" "int size" 49.Ft void 50.Fn vm_page_set_validclean "vm_page_t m" "int base" "int size" 51.Ft void 52.Fn vm_page_clear_dirty "vm_page_t m" "int base" "int size" 53.Ft void 54.Fn vm_page_set_invalid "vm_page_t m" "int base" "int size" 55.Ft void 56.Fn vm_page_zero_invalid "vm_page_t m" "boolean_t setvalid" 57.Ft int 58.Fn vm_page_is_valid "vm_page_t m" "int base" "int size" 59.Ft void 60.Fn vm_page_test_dirty "vm_page_t m" 61.Ft void 62.Fn vm_page_dirty "vm_page_t m" 63.Ft void 64.Fn vm_page_undirty "vm_page_t m" 65.Sh DESCRIPTION 66.Fn vm_page_bits 67calculates the bits representing the 68.Dv DEV_BSIZE 69range of bytes between 70.Fa base 71and 72.Fa size . 73The byte range is expected to be within a single page, and if 74.Fa size 75is zero no bits will be set. 76.Pp 77.\" ------------------- VM_PAGE_SET_VALIDCLEAN ------------------- 78.Fn vm_page_set_validclean 79flags the byte range between 80.Fa base 81and 82.Fa size 83as valid and clean. 84The range is expected to be 85.Dv DEV_BSIZE 86aligned and no larger than 87.Dv PAGE_SIZE . 88If it is not properly aligned, any unaligned chucks of the 89.Dv DEV_BSIZE 90blocks at the beginning and end of the range will be zeroed. 91.Pp 92If 93.Fa base 94is zero and 95.Fa size 96is one page the modified bit in the page map is cleared; as well, 97the 98.Dv PG_NOSYNC 99flag is cleared. 100.Pp 101.Fn vm_page_clear_dirty 102clears the dirty bits within a page in the range between 103.Fa base 104and 105.Fa size . 106The bits representing the range are calculated by calling 107.Fn vm_page_bits . 108.Pp 109.Fn vm_page_set_invalid 110clears the bits in both the valid and dirty flags representing 111the 112.Dv DEV_BSIZE 113blocks between 114.Fa base 115and 116.Fa size 117in the page. 118The bits are calculated by calling 119.Fn vm_page_bits . 120As well as clearing the bits within the page, the generation 121number within the object holding the page is incremented. 122.Pp 123.Fn vm_page_zero_invalid 124zeros all of the blocks within the page that are currently 125flaged as invalid. 126If 127.Fa setvalid 128is TRUE, all of the valid bits within the page are set. 129.Pp 130In some cases, such as NFS, the valid bits cannot be set 131in order to maintain cache consistency. 132.Pp 133.Fn vm_page_is_valid 134checks to determine if the all of the 135.Dv DEV_BSIZE 136blocks between 137.Fa base 138and 139.Fa size 140of the page are valid. 141If 142.Fa size 143is zero and the page is entirely invalid 144.Fn vm_page_is_valid 145will return TRUE, in all other cases 146a size of zero will return FALSE. 147.Pp 148.Fn vm_page_test_dirty 149checks if a page has been modified via any of its physical maps, 150and if so flags the entire page as dirty. 151.Fn vm_page_dirty 152is called to modify the dirty bits. 153.Pp 154.Fn vm_page_dirty 155flags the entire page as dirty. 156It is expected that the page is not currently on the cache queue. 157.Pp 158.Fn vm_page_undirty 159clears all of the dirty bits in a page. 160.Sh NOTES 161None of these functions are allowed to block. 162.Sh AUTHORS 163This man page was written by 164.An Chad David Aq davidc@acns.ab.ca . 165