diff options
author | delphij <delphij@FreeBSD.org> | 2009-09-28 16:59:47 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2009-09-28 16:59:47 +0000 |
commit | 79f2f8c774b48d4ef62f92d4a09e80af3ceaca7c (patch) | |
tree | 1cca7c0ea10e2ad0213a1d75a2c8a8fe0061f4d4 /sys/kern/vfs_vnops.c | |
parent | fd5f08e3e82b6caa8a7fff6a32c9e56b9212003e (diff) | |
download | FreeBSD-src-79f2f8c774b48d4ef62f92d4a09e80af3ceaca7c.zip FreeBSD-src-79f2f8c774b48d4ef62f92d4a09e80af3ceaca7c.tar.gz |
Add two new fcntls to enable/disable read-ahead:
- F_READAHEAD: specify the amount for sequential access. The amount is
specified in bytes and is rounded up to nearest block size.
- F_RDAHEAD: Darwin compatible version that use 128KB as the sequential
access size.
A third argument of zero disables the read-ahead behavior.
Please note that the read-ahead amount is also constrainted by sysctl
variable, vfs.read_max, which may need to be raised in order to better
utilize this feature.
Thanks Igor Sysoev for proposing the feature and submitting the original
version, and kib@ for his valuable comments.
Submitted by: Igor Sysoev <is rambler-co ru>
Reviewed by: kib@
MFC after: 1 month
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r-- | sys/kern/vfs_vnops.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 1b77352..03e8d93 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -312,6 +312,9 @@ static int sequential_heuristic(struct uio *uio, struct file *fp) { + if (atomic_load_acq_int(&(fp->f_flag)) & FRDAHEAD) + return (fp->f_seqcount << IO_SEQSHIFT); + /* * Offset 0 is handled specially. open() sets f_seqcount to 1 so * that the first I/O is normally considered to be slightly |