VERITAS File System 3.5 (HP OnlineJFS/JFS 3.5) Administrator's Guide (August 2003)
Chapter 4
Application Interface
Extent Information
58
Extent Information
The VX_SETEXT ioctl command allows an application to reserve space for a file, and set fixed extent sizes
and file allocation flags. Applications can obtain status information on VxFS ioctls by using the VX_GETEXT
ioctl. The getext command also provides access to this information. See the getext (1), setext (1), and vxfsio
(7) manual pages for more information.
The VX_SETEXT ioctl command allows an application to reserve space for a file, and set fixed extent sizes
and file allocation flags. The current state of much of this information can be obtained by applications by
using the VX_GETEXT ioctl (the getext command provides access to this functionality). For details, see the
getext (1), setext (1), and vxfsio (7) manual pages.
Each invocation of the VX_SETEXT ioctl affects all the elements in the vx_ext structure. When using
VX_SETEXT, always use the following procedure:
Step 1. Use VX_GETEXT to read the current settings.
Step 2. Modify the values to be changed.
Step 3. Call VX_SETEXT to set the values.
CAUTION Follow this procedure carefully. A fixed extent size may be inadvertently cleared
when the reservation is changed.
Space Reservation
Storage can be reserved for a file at any time. When a VX_SETEXT ioctl is issued, the reservation value is set
in the inode on disk. If the file size is less than the reservation amount, the kernel allocates space to the file
from the current file size up to the reservation amount. When the file is truncated, space below the reserved
amount is not freed. The VX_TRIM, VX_NOEXTEND, VX_CHGSIZE, VX_NORESERVE and VX_CONTIGUOUS flags can
be used to modify reservation requests.
NOTE VX_NOEXTEND is the only one of these flags that is persistent; the other flags may have
persistent effects, but they are not returned by the VX_GETEXT ioctl.
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.