Page MenuHomeFreeBSD

D29637.id87003.diff
No OneTemporary

D29637.id87003.diff

Index: share/man/man9/vnode_pager_setsize.9
===================================================================
--- share/man/man9/vnode_pager_setsize.9
+++ share/man/man9/vnode_pager_setsize.9
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd April 6, 2021
+.Dd April 8, 2021
.Dt VNODE_PAGER_SETSIZE 9
.Os
.Sh NAME
@@ -42,13 +42,23 @@
.Sh DESCRIPTION
.Nm
lets the VM system know about a change in size for a file.
-Content beyond the new EOF specified by the
-.Fa nsize
-argument will be purged from the cache.
+Content between the old EOF and the new EOF will be purged from the cache
+if the file size shrinks.
+In case the vnode
+.Fa vp
+does not have a VM object, the effect of calling this function is no-op.
+.Pp
+The new EOF is rounded up to the nearest page index as a boundary
+within which the page fault handler should handle.
+.Pp
This function is useful for use within file system code to implement
truncation in
.Xr VOP_SETATTR 9 .
.Sh IMPLEMENTATION NOTES
+The function updates the object size of the vm object in
+.Fa vp
+with the new EOF specified by the
+.Fa nsize .
In case the new EOF specified by the
.Fa nsize
argument is not aligned to page boundaries,
@@ -57,10 +67,8 @@
for content occupying whole blocks within block
boundaries,
the dirty bits for the corresponding blocks will be cleared.
-.Sh LOCKING
-Writer lock of the VM object of
-.Fa vp
-will be held within the function.
+.Sh LOCKS
+The vnode should be exclusively locked on entry and will still be locked on exit.
.Sh SEE ALSO
.Xr vnode 9
.Sh HISTORY

File Metadata

Mime Type
text/plain
Expires
Fri, Jun 12, 11:26 PM (1 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33917007
Default Alt Text
D29637.id87003.diff (1 KB)

Event Timeline