VERITAS File System 4.1 Administrator's Guide

Application Interface
Cache Advisories
Chapter 476
Cache Advisories
VxFS allows an application to set cache advisories for use when accessing files. These
advisories are in memory only and they do not persist across reboots. Some advisories are
currently maintained on a per-file, not a per-file-descriptor, basis. This means that only one
set of advisories can be in effect for all accesses to the file. If two conflicting applications set
different advisories, both use the last advisories that were set.
All advisories are set using the VX_SETCACHE ioctl command. The current set of advisories
can be obtained with the VX_GETCACHE ioctl command. For details on the use of these ioctl
commands, see the vxfsio (7) manual page.
Direct I/O
Direct I/O is an unbuffered form of I/O. If the VX_DIRECT advisory is set, the user is requesting
direct data transfer between the disk and the user-supplied buffer for reads and writes. This
bypasses the kernel buffering of data, and reduces the CPU overhead associated with I/O by
eliminating the data copy between the kernel buffer and the user’s buffer. This also avoids
taking up space in the buffer cache that might be better used for something else. The direct
I/O feature can provide significant performance gains for some applications.
For an I/O operation to be performed as direct I/O, it must meet certain alignment criteria.
The alignment constraints are usually determined by the disk driver, the disk controller, and
the system memory management hardware and software. The requirements for direct I/O are
as follows:
The starting file offset must be aligned to a 512-byte boundary.
The ending file offset must be aligned to a 512-byte boundary, or the length must be a
multiple of 512 bytes.
The memory buffer must start on an 8-byte boundary.
If the I/O is performed using the readv(2) and writev(2) system calls, these restrictions
apply to each element of the array of structiovec.
The requirements to perform direct I/O on a given platform and operating system release may
be less restrictive than above, but these requirements are met, then direct I/O will work on
any platform. In particular, Solaris and HP-UX do not require any alignment of the memory
buffer.
Also note that on HP-UX, direct I/O will be the most efficient if the starting and ending file
offsets are aligned on file system block boundaries, as reported in the field f_frsize of
statvfs(2).