diff options
author | dillon <dillon@FreeBSD.org> | 2001-05-24 07:22:27 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2001-05-24 07:22:27 +0000 |
commit | a179ee09ab9ca2d9d1d09dc4752c53a13609f5e9 (patch) | |
tree | faca8401754525a67aa26f144230806cf238e370 /lib | |
parent | a26134411c10ba2364d3d85686667b8a87f0015f (diff) | |
download | FreeBSD-src-a179ee09ab9ca2d9d1d09dc4752c53a13609f5e9.zip FreeBSD-src-a179ee09ab9ca2d9d1d09dc4752c53a13609f5e9.tar.gz |
This patch implements O_DIRECT about 80% of the way. It takes a patchset
Tor created a while ago, removes the raw I/O piece (that has cache coherency
problems), and adds a buffer cache / VM freeing piece.
Essentially this patch causes O_DIRECT I/O to not be left in the cache, but
does not prevent it from going through the cache, hence the 80%. For
the last 20% we need a method by which the I/O can be issued directly to
buffer supplied by the user process and bypass the buffer cache entirely,
but still maintain cache coherency.
I also have the code working under -stable but the changes made to sys/file.h
may not be MFCable, so an MFC is not on the table yet.
Submitted by: tegge, dillon
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/sys/fcntl.2 | 5 | ||||
-rw-r--r-- | lib/libc/sys/open.2 | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/libc/sys/fcntl.2 b/lib/libc/sys/fcntl.2 index b2911e5..479e097 100644 --- a/lib/libc/sys/fcntl.2 +++ b/lib/libc/sys/fcntl.2 @@ -147,6 +147,11 @@ corresponds to the .Dv O_APPEND flag of .Xr open 2 . +.It Dv O_DIRECT +Minimize or eliminate the cache effects of reading and writing. The system +will attempt to avoid caching the data you read or write. If it cannot +avoid caching the data, it will minimize the impact the data has on the cache. +Use of this flag can drastically reduce performance if not used with care. .It Dv O_ASYNC Enable the .Dv SIGIO diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index 769ac27..1a29a17 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -83,6 +83,7 @@ O_TRUNC truncate size to 0 O_EXCL error if create and file exists O_SHLOCK atomically obtain a shared lock O_EXLOCK atomically obtain an exclusive lock +O_DIRECT eliminate or reduce cache effects O_FSYNC synchronous writes O_NOFOLLOW do not follow symlinks .Ed @@ -150,6 +151,12 @@ If creating a file with the request for the lock will never fail (provided that the underlying filesystem supports locking). .Pp +.Dv O_DIRECT may be used to +minimize or eliminate the cache effects of reading and writing. The system +will attempt to avoid caching the data you read or write. If it cannot +avoid caching the data, it will minimize the impact the data has on the cache. +Use of this flag can drastically reduce performance if not used with care. +.Pp If successful, .Fn open returns a non-negative integer, termed a file descriptor. |