xref: /minix3/lib/libpuffs/puffs_flush.3 (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1 *84d9c625SLionel Sambuc.\"	$NetBSD: puffs_flush.3,v 1.8 2009/02/20 14:26:56 pooka Exp $
2 *84d9c625SLionel Sambuc.\"
3 *84d9c625SLionel Sambuc.\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
4 *84d9c625SLionel Sambuc.\"
5 *84d9c625SLionel Sambuc.\" Redistribution and use in source and binary forms, with or without
6 *84d9c625SLionel Sambuc.\" modification, are permitted provided that the following conditions
7 *84d9c625SLionel Sambuc.\" are met:
8 *84d9c625SLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright
9 *84d9c625SLionel Sambuc.\"    notice, this list of conditions and the following disclaimer.
10 *84d9c625SLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright
11 *84d9c625SLionel Sambuc.\"    notice, this list of conditions and the following disclaimer in the
12 *84d9c625SLionel Sambuc.\"    documentation and/or other materials provided with the distribution.
13 *84d9c625SLionel Sambuc.\"
14 *84d9c625SLionel Sambuc.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 *84d9c625SLionel Sambuc.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 *84d9c625SLionel Sambuc.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 *84d9c625SLionel Sambuc.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 *84d9c625SLionel Sambuc.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 *84d9c625SLionel Sambuc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 *84d9c625SLionel Sambuc.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 *84d9c625SLionel Sambuc.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 *84d9c625SLionel Sambuc.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 *84d9c625SLionel Sambuc.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 *84d9c625SLionel Sambuc.\" SUCH DAMAGE.
25 *84d9c625SLionel Sambuc.\"
26 *84d9c625SLionel Sambuc.Dd April 7, 2007
27 *84d9c625SLionel Sambuc.Dt PUFFS_FLUSH 3
28 *84d9c625SLionel Sambuc.Os
29 *84d9c625SLionel Sambuc.Sh NAME
30 *84d9c625SLionel Sambuc.Nm puffs_flush
31 *84d9c625SLionel Sambuc.Nd puffs kernel cache flushing and invalidation routines
32 *84d9c625SLionel Sambuc.Sh LIBRARY
33 *84d9c625SLionel Sambuc.Lb libpuffs
34 *84d9c625SLionel Sambuc.Sh SYNOPSIS
35 *84d9c625SLionel Sambuc.In puffs.h
36 *84d9c625SLionel Sambuc.Ft int
37 *84d9c625SLionel Sambuc.Fo puffs_inval_namecache_dir
38 *84d9c625SLionel Sambuc.Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie"
39 *84d9c625SLionel Sambuc.Fc
40 *84d9c625SLionel Sambuc.Ft int
41 *84d9c625SLionel Sambuc.Fn puffs_inval_namecache_all "struct puffs_usermount *pu"
42 *84d9c625SLionel Sambuc.Ft int
43 *84d9c625SLionel Sambuc.Fo puffs_inval_pagecache_node
44 *84d9c625SLionel Sambuc.Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie"
45 *84d9c625SLionel Sambuc.Fc
46 *84d9c625SLionel Sambuc.Ft int
47 *84d9c625SLionel Sambuc.Fo puffs_inval_pagecache_node_range
48 *84d9c625SLionel Sambuc.Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie" "off_t start"
49 *84d9c625SLionel Sambuc.Fa "off_t end"
50 *84d9c625SLionel Sambuc.Fc
51 *84d9c625SLionel Sambuc.Ft int
52 *84d9c625SLionel Sambuc.Fo puffs_flush_pagecache_node
53 *84d9c625SLionel Sambuc.Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie"
54 *84d9c625SLionel Sambuc.Fc
55 *84d9c625SLionel Sambuc.Ft int
56 *84d9c625SLionel Sambuc.Fo puffs_flush_pagecache_node_range
57 *84d9c625SLionel Sambuc.Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie" "off_t start"
58 *84d9c625SLionel Sambuc.Fa "off_t end"
59 *84d9c625SLionel Sambuc.Fc
60 *84d9c625SLionel Sambuc.Sh DESCRIPTION
61 *84d9c625SLionel SambucThese routines are used inform the kernel that any information it might
62 *84d9c625SLionel Sambuchave cached is no longer valid.
63 *84d9c625SLionel Sambuc.Fn puffs_inval_namecache_dir
64 *84d9c625SLionel Sambucinvalidates the name cache for a given directory.
65 *84d9c625SLionel SambucThe argument
66 *84d9c625SLionel Sambuc.Va cookie
67 *84d9c625SLionel Sambucshould describe an existing and valid directory cookie for the file
68 *84d9c625SLionel Sambucsystem.
69 *84d9c625SLionel SambucSimilarly,
70 *84d9c625SLionel Sambuc.Fn puffs_inval_namecache_all
71 *84d9c625SLionel Sambucinvalidates the name cache for the entire file system
72 *84d9c625SLionel Sambuc(this routine might go away).
73 *84d9c625SLionel Sambuc.Pp
74 *84d9c625SLionel SambucThe cached pages (file contents) for a regular file described by
75 *84d9c625SLionel Sambuc.Va cookie
76 *84d9c625SLionel Sambucare invalidated using
77 *84d9c625SLionel Sambuc.Fn puffs_inval_pagecache_node .
78 *84d9c625SLionel SambucA specific range can be invalidated using
79 *84d9c625SLionel Sambuc.Fn puffs_inval_pagecache_node_range
80 *84d9c625SLionel Sambucfor a platform specific page level granularity.
81 *84d9c625SLionel SambucThe offset
82 *84d9c625SLionel Sambuc.Va start
83 *84d9c625SLionel Sambucwill be
84 *84d9c625SLionel Sambuc.Em truncated
85 *84d9c625SLionel Sambucto a page boundary while
86 *84d9c625SLionel Sambuc.Va end
87 *84d9c625SLionel Sambucwill be
88 *84d9c625SLionel Sambuc.Em "rounded up"
89 *84d9c625SLionel Sambucto the next page boundary.
90 *84d9c625SLionel SambucAs a special case, specifying 0 as
91 *84d9c625SLionel Sambuc.Va end
92 *84d9c625SLionel Sambucwill invalidate all contents from
93 *84d9c625SLionel Sambuc.Va start
94 *84d9c625SLionel Sambucto the end of the file.
95 *84d9c625SLionel Sambuc.Pp
96 *84d9c625SLionel SambucIt is especially important to note that these routines will not only
97 *84d9c625SLionel Sambucinvalidate data in the "read cache", but also data in the "write back"
98 *84d9c625SLionel Sambuccache (conceptually speaking; in reality they are the same cache), which
99 *84d9c625SLionel Sambuchas not yet been flushed to the file server.
100 *84d9c625SLionel SambucTherefore any unflushed data will be lost.
101 *84d9c625SLionel Sambuc.Pp
102 *84d9c625SLionel SambucThe counterparts of the invalidation routines are the flushing routines
103 *84d9c625SLionel Sambuc.Fn puffs_flush_pagecache_node
104 *84d9c625SLionel Sambucand
105 *84d9c625SLionel Sambuc.Fn puffs_flush_pagecache_node_range ,
106 *84d9c625SLionel Sambucwhich force unwritten data from the kernel page cache to be written.
107 *84d9c625SLionel SambucFor the flush range version, the same range rules as with the
108 *84d9c625SLionel Sambucinvalidation routine apply.
109 *84d9c625SLionel SambucThe data is flushed asynchronously, i.e. if the routine returns
110 *84d9c625SLionel Sambucsuccessfully, all the caller knows is that the data has been queued
111 *84d9c625SLionel Sambucfor writing.
112 *84d9c625SLionel Sambuc.Sh SEE ALSO
113 *84d9c625SLionel Sambuc.Xr puffs 3
114