aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/vnode.h
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2011-11-04 04:02:50 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2011-11-04 04:02:50 +0000
commit936c09ac0f32aa16d60492cebe7254b0631105eb (patch)
tree159ae25b13b965df34d0e93885cca08178c0b2a2 /sys/sys/vnode.h
parentdccc45e4c095172c99b9b30d4e7dfcc4ac44c295 (diff)
downloadsrc-936c09ac0f32aa16d60492cebe7254b0631105eb.tar.gz
src-936c09ac0f32aa16d60492cebe7254b0631105eb.zip
Add the posix_fadvise(2) system call. It is somewhat similar to
madvise(2) except that it operates on a file descriptor instead of a memory region. It is currently only supported on regular files. Just as with madvise(2), the advice given to posix_fadvise(2) can be divided into two types. The first type provide hints about data access patterns and are used in the file read and write routines to modify the I/O flags passed down to VOP_READ() and VOP_WRITE(). These modes are thus filesystem independent. Note that to ease implementation (and since this API is only advisory anyway), only a single non-normal range is allowed per file descriptor. The second type of hints are used to hint to the OS that data will or will not be used. These hints are implemented via a new VOP_ADVISE(). A default implementation is provided which does nothing for the WILLNEED request and attempts to move any clean pages to the cache page queue for the DONTNEED request. This latter case required two other changes. First, a new V_CLEANONLY flag was added to vinvalbuf(). This requests vinvalbuf() to only flush clean buffers for the vnode from the buffer cache and to not remove any backing pages from the vnode. This is used to ensure clean pages are not wired into the buffer cache before attempting to move them to the cache page queue. The second change adds a new vm_object_page_cache() method. This method is somewhat similar to vm_object_page_remove() except that instead of freeing each page in the specified range, it attempts to move clean pages to the cache queue if possible. To preserve the ABI of struct file, the f_cdevpriv pointer is now reused in a union to point to the currently active advice region if one is present for regular files. Reviewed by: jilles, kib, arch@ Approved by: re (kib) MFC after: 1 month
Notes
Notes: svn path=/head/; revision=227070
Diffstat (limited to 'sys/sys/vnode.h')
-rw-r--r--sys/sys/vnode.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 4cb6633d4cc8..7382336623fe 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -384,6 +384,7 @@ extern int vttoif_tab[];
#define V_SAVE 0x0001 /* vinvalbuf: sync file first */
#define V_ALT 0x0002 /* vinvalbuf: invalidate only alternate bufs */
#define V_NORMAL 0x0004 /* vinvalbuf: invalidate only regular bufs */
+#define V_CLEANONLY 0x0008 /* vinvalbuf: invalidate only clean bufs */
#define REVOKEALL 0x0001 /* vop_revoke: revoke all aliases */
#define V_WAIT 0x0001 /* vn_start_write: sleep for suspend */
#define V_NOWAIT 0x0002 /* vn_start_write: don't sleep for suspend */
@@ -685,6 +686,7 @@ int vop_stdunlock(struct vop_unlock_args *);
int vop_nopoll(struct vop_poll_args *);
int vop_stdaccess(struct vop_access_args *ap);
int vop_stdaccessx(struct vop_accessx_args *ap);
+int vop_stdadvise(struct vop_advise_args *ap);
int vop_stdadvlock(struct vop_advlock_args *ap);
int vop_stdadvlockasync(struct vop_advlockasync_args *ap);
int vop_stdadvlockpurge(struct vop_advlockpurge_args *ap);