Veritas File System 4.1 Administrator's Guide (HP-UX 11i v3, February 2007)
Application Interface
Extent Information
Chapter 4 65
If the VX_TRIM flag is set, when the last close occurs on the inode, the reservation is trimmed to match the
file size and the VX_TRIM flag is cleared. Any unused space is freed. This can be useful if an application
needs enough space for a file, but it is not known how large the file will become. Enough space can be
reserved to hold the largest expected file, and when the file has been written and closed, any extra space will
be released.
If the VX_NOEXTEND flag is set, an attempt to write beyond the current reservation, which requires the
allocation of new space for the file, fails instead. To allocate new space to the file, the space reservation must
be increased. This can be used like ulimit to prevent a file from using too much space.
If the VX_CONTIGUOUS flag is set, any space allocated to satisfy the current reservation request is allocated
in one extent. If there is not one extent large enough to satisfy the request, the request fails. For example, if a
file is created and a 1 MB contiguous reservation is requested, the file size is set to zero and the reservation
to 1 MB. The file will have one extent that is 1 MB long. If another reservation request is made for a 3 MB
contiguous reservation, the new request will find that the first 1 MB is already allocated and allocate a 2 MB
extent to satisfy the request. If there are no 2 MB extents available, the request fails. Extents are, by
definition, contiguous.
NOTE Because VX_CONTIGUOUS is not a persistent flag, space will not be allocated contiguously
after doing a file system restore.
If the VX_NORESERVE flag is set, the reservation value in the inode is not changed. This flag is used by
applications to do temporary reservation. Any space past the end of the file is given up when the file is
closed. For example, if the cp command is copying a file that is 1 MB long, it can request a 1 MB reservation
with the VX_NORESERVE flag set. The space is allocated, but the reservation in the file is left at 0. If the
program aborts for any reason or the system crashes, the unused space past the end of the file is released.
When the program finishes, there is no cleanup because the reservation was never recorded on disk.
If the VX_CHGSIZE flag is set, the file size is increased to match the reservation amount. This flag can be
used to create files with uninitialized data. Because this allows uninitialized data in files, it is restricted to
users with appropriate privileges.
It is possible to use these flags in combination. For example, using VX_CHGSIZE and VX_NORESERVE
changes the file size but does not set any reservation. When the file is truncated, the space is freed. If the
VX_NORESERVE flag had not been used, the reservation would have been set on disk along with the file size.
Space reservation is used to make sure applications do not fail because the file system is out of space. An
application can preallocate space for all the files it needs before starting to do any work. By allocating space
in advance, the file is optimally allocated for performance, and file accesses are not slowed down by the
need to allocate storage. This allocation of resources can be important in applications that require a
guaranteed response time.