summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_syscalls.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-06-19 18:42:24 +0000
committerjhb <jhb@FreeBSD.org>2012-06-19 18:42:24 +0000
commit571562fffb435a478f0591879dd19fe9227cb52e (patch)
tree141cada499e4a3898e0f0daa125723e411568387 /sys/kern/vfs_syscalls.c
parente551b0ecfb98653b427343a9dc4e018566a78913 (diff)
downloadFreeBSD-src-571562fffb435a478f0591879dd19fe9227cb52e.zip
FreeBSD-src-571562fffb435a478f0591879dd19fe9227cb52e.tar.gz
Further refine the implementation of POSIX_FADV_NOREUSE.
First, extend the changes in r230782 to better handle the common case of using NOREUSE with sequential reads. A NOREUSE file descriptor will now track the last implicit DONTNEED request it made as a result of a NOREUSE read. If a subsequent NOREUSE read is adjacent to the previous range, it will apply the DONTNEED request to the entire range of both the previous read and the current read. The effect is that each read of a file accessed sequentially will apply the DONTNEED request to the entire range that has been read. This allows NOREUSE to properly handle misaligned reads by flushing each buffer to cache once it has been completely read. Second, apply the same changes made to read(2) by r230782 and this change to writes. This provides much better performance in the sequential write case as it allows writes to still be clustered. It also provides much better performance for misaligned writes. It does mean that NOREUSE will be generally ineffective for non-sequential writes as the current implementation relies on a future NOREUSE write's implicit DONTNEED request to flush the dirty buffer from the current write. MFC after: 2 weeks
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r--sys/kern/vfs_syscalls.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 3c719d7..27b419c 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -4872,6 +4872,8 @@ kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len,
new->fa_advice = advice;
new->fa_start = offset;
new->fa_end = end;
+ new->fa_prevstart = 0;
+ new->fa_prevend = 0;
fp->f_advice = new;
new = fa;
}
OpenPOWER on IntegriCloud