1 .\" $NetBSD: puffs_flush.3,v 1.8 2009/02/20 14:26:56 pooka Exp $
3 .\" Copyright (c) 2007 Antti Kantee. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .Nd puffs kernel cache flushing and invalidation routines
37 .Fo puffs_inval_namecache_dir
38 .Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie"
41 .Fn puffs_inval_namecache_all "struct puffs_usermount *pu"
43 .Fo puffs_inval_pagecache_node
44 .Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie"
47 .Fo puffs_inval_pagecache_node_range
48 .Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie" "off_t start"
52 .Fo puffs_flush_pagecache_node
53 .Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie"
56 .Fo puffs_flush_pagecache_node_range
57 .Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie" "off_t start"
61 These routines are used inform the kernel that any information it might
62 have cached is no longer valid.
63 .Fn puffs_inval_namecache_dir
64 invalidates the name cache for a given directory.
67 should describe an existing and valid directory cookie for the file
70 .Fn puffs_inval_namecache_all
71 invalidates the name cache for the entire file system
72 (this routine might go away).
74 The cached pages (file contents) for a regular file described by
77 .Fn puffs_inval_pagecache_node .
78 A specific range can be invalidated using
79 .Fn puffs_inval_pagecache_node_range
80 for a platform specific page level granularity.
85 to a page boundary while
89 to the next page boundary.
90 As a special case, specifying 0 as
92 will invalidate all contents from
94 to the end of the file.
96 It is especially important to note that these routines will not only
97 invalidate data in the "read cache", but also data in the "write back"
98 cache (conceptually speaking; in reality they are the same cache), which
99 has not yet been flushed to the file server.
100 Therefore any unflushed data will be lost.
102 The counterparts of the invalidation routines are the flushing routines
103 .Fn puffs_flush_pagecache_node
105 .Fn puffs_flush_pagecache_node_range ,
106 which force unwritten data from the kernel page cache to be written.
107 For the flush range version, the same range rules as with the
108 invalidation routine apply.
109 The data is flushed asynchronously, i.e. if the routine returns
110 successfully, all the caller knows is that the data has been queued