man.bsd.lv manual page server

Manual Page Search Parameters

PUFFS_FLUSH(3) Library Functions Manual PUFFS_FLUSH(3)

puffs_flushpuffs kernel cache flushing and invalidation routines

library “libpuffs”

#include <puffs.h>

int
puffs_inval_namecache_dir(struct puffs_usermount *pu, puffs_cookie_t cookie);

int
puffs_inval_namecache_all(struct puffs_usermount *pu);

int
puffs_inval_pagecache_node(struct puffs_usermount *pu, puffs_cookie_t cookie);

int
puffs_inval_pagecache_node_range(struct puffs_usermount *pu, puffs_cookie_t cookie, off_t start, off_t end);

int
puffs_flush_pagecache_node(struct puffs_usermount *pu, puffs_cookie_t cookie);

int
puffs_flush_pagecache_node_range(struct puffs_usermount *pu, puffs_cookie_t cookie, off_t start, off_t end);

These routines are used inform the kernel that any information it might have cached is no longer valid. () invalidates the name cache for a given directory. The argument cookie should describe an existing and valid directory cookie for the file system. Similarly, () invalidates the name cache for the entire file system (this routine might go away).

The cached pages (file contents) for a regular file described by cookie are invalidated using (). A specific range can be invalidated using () for a platform specific page level granularity. The offset start will be to a page boundary while end will be to the next page boundary. As a special case, specifying 0 as end will invalidate all contents from start to the end of the file.

It is especially important to note that these routines will not only invalidate data in the "read cache", but also data in the "write back" cache (conceptually speaking; in reality they are the same cache), which has not yet been flushed to the file server. Therefore any unflushed data will be lost.

The counterparts of the invalidation routines are the flushing routines () and (), which force unwritten data from the kernel page cache to be written. For the flush range version, the same range rules as with the invalidation routine apply. The data is flushed asynchronously, i.e. if the routine returns successfully, all the caller knows is that the data has been queued for writing.

puffs(3)

April 7, 2007 NetBSD-9.2