]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Further refine the implementation of POSIX_FADV_NOREUSE.
authorjhb <jhb@FreeBSD.org>
Tue, 19 Jun 2012 18:42:24 +0000 (18:42 +0000)
committerjhb <jhb@FreeBSD.org>
Tue, 19 Jun 2012 18:42:24 +0000 (18:42 +0000)
commit571562fffb435a478f0591879dd19fe9227cb52e
tree141cada499e4a3898e0f0daa125723e411568387
parente551b0ecfb98653b427343a9dc4e018566a78913
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
lib/libc/sys/posix_fadvise.2
sys/kern/vfs_syscalls.c
sys/kern/vfs_vnops.c
sys/sys/file.h