xref: /netbsd/lib/libpuffs/puffs_flush.3 (revision 622f8591)
1*622f8591Spooka.\"	$NetBSD: puffs_flush.3,v 1.2 2007/04/06 16:44:01 pooka Exp $
2809ae5f8Spooka.\"
3809ae5f8Spooka.\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
4809ae5f8Spooka.\"
5809ae5f8Spooka.\" Redistribution and use in source and binary forms, with or without
6809ae5f8Spooka.\" modification, are permitted provided that the following conditions
7809ae5f8Spooka.\" are met:
8809ae5f8Spooka.\" 1. Redistributions of source code must retain the above copyright
9809ae5f8Spooka.\"    notice, this list of conditions and the following disclaimer.
10809ae5f8Spooka.\" 2. Redistributions in binary form must reproduce the above copyright
11809ae5f8Spooka.\"    notice, this list of conditions and the following disclaimer in the
12809ae5f8Spooka.\"    documentation and/or other materials provided with the distribution.
13809ae5f8Spooka.\"
14809ae5f8Spooka.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15809ae5f8Spooka.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16809ae5f8Spooka.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17809ae5f8Spooka.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18809ae5f8Spooka.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19809ae5f8Spooka.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20809ae5f8Spooka.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21809ae5f8Spooka.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22809ae5f8Spooka.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23809ae5f8Spooka.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24809ae5f8Spooka.\" SUCH DAMAGE.
25809ae5f8Spooka.\"
26*622f8591Spooka.Dd April 7, 2007
27809ae5f8Spooka.Dt PUFFS_FLUSH 3
28809ae5f8Spooka.Os
29809ae5f8Spooka.Sh NAME
30809ae5f8Spooka.Nm puffs_flush
31809ae5f8Spooka.Nd puffs kernel cache flushing and invalidation routines
32809ae5f8Spooka.Sh LIBRARY
33809ae5f8Spooka.Lb libpuffs
34809ae5f8Spooka.Sh SYNOPSIS
35809ae5f8Spooka.In puffs.h
36809ae5f8Spooka.Ft int
37809ae5f8Spooka.Fn puffs_inval_namecache_dir "struct puffs_usermount *pu" "void *cookie"
38809ae5f8Spooka.Ft int
39809ae5f8Spooka.Fn puffs_inval_namecache_all "struct puffs_usermount *pu"
40*622f8591Spooka.Ft int
41*622f8591Spooka.Fn puffs_inval_pagecache_node "struct puffs_usermoint *pu" "void *cookie"
42*622f8591Spooka.Ft int
43*622f8591Spooka.Fo puffs_inval_pagecache_node_range
44*622f8591Spooka.Fa "struct puffs_usermoint *pu" "void *cookie" "off_t start" "off_t end"
45*622f8591Spooka.Fc
46809ae5f8Spooka.Sh DESCRIPTION
47809ae5f8Spooka.Em IMPORTANT NOTE!
48809ae5f8SpookaThis document describes interfaces which are not yet guaranteed to be
49809ae5f8Spookastable.
50809ae5f8SpookaIn case you update your system sources, please recompile everything
51809ae5f8Spookaand fix complation errors.
52809ae5f8SpookaIf your sources are out-of-sync, incorrect operation may result.
53809ae5f8SpookaThe interfaces in this document will most likely be hugely simplified
54809ae5f8Spookain later versions or made transparent to the implementation.
55809ae5f8Spooka.Pp
56809ae5f8SpookaThese routines are used inform the kernel that any information it might
57809ae5f8Spookahave cached is no longer valid.
58809ae5f8Spooka.Fn puffs_inval_namecache_dir
59809ae5f8Spookainvalidates the name cache for a given directory.
60809ae5f8SpookaThe argument
61809ae5f8Spooka.Va cookie
62809ae5f8Spookashould describe an existing and valid directory cookie for the file
63809ae5f8Spookasystem.
64809ae5f8SpookaSimilarly,
65809ae5f8Spooka.Fn puffs_inval_namecache_all
66809ae5f8Spookainvalidates the name cache for the entire file system
67809ae5f8Spooka(this routine might go away).
68*622f8591Spooka.Pp
69*622f8591SpookaThe cached pages (file contents) for a regular file described by
70*622f8591Spooka.Va cookie
71*622f8591Spookaare invalidated using
72*622f8591Spooka.Fn puffs_inval_pagecache_node .
73*622f8591SpookaA specific range can be invalidated using
74*622f8591Spooka.Fn puffs_inval_pagecache_node_range
75*622f8591Spookafor a platform specific page level granularity.
76*622f8591SpookaThe offset
77*622f8591Spooka.Va start
78*622f8591Spookawill be
79*622f8591Spooka.Em truncated
80*622f8591Spookato a page boundary while
81*622f8591Spooka.Va end
82*622f8591Spookawill be
83*622f8591Spooka.Em "rounded up"
84*622f8591Spookato the next page boundary.
85*622f8591SpookaAs a special case, specifying 0 as
86*622f8591Spooka.Va end
87*622f8591Spookawill invalidate all contents from
88*622f8591Spooka.Va start
89*622f8591Spookato the end of the file.
90*622f8591Spooka.Pp
91*622f8591SpookaIt is especially important to note that these routines will not only
92*622f8591Spookainvalidate data in the "read cache", but also data in the "write back"
93*622f8591Spookacache (conceptually speaking; in reality they are the same cache), which
94*622f8591Spookahas not yet been flushed to the file server.
95*622f8591SpookaTherefore any unflushed data will be lost.
96809ae5f8Spooka.Sh SEE ALSO
97809ae5f8Spooka.Xr puffs 3
98*622f8591Spooka.Sh BUGS
99*622f8591SpookaRoutines for forcing a flush of the page cache for a node are not
100*622f8591Spookayet implemented.
101