Symantec logo

Application programming interface for extent attributes

The current API for extent attributes is ioctl(). Applications can open a file and use the returned file descriptor with calls to ioctl() to retrieve, set, or change extent attributes. To set or change existing extent attributes, use the VX_SETEXT ioctl. To retrieve existing extent attributes, if any, use the VX_GETEXT ioctl. Applications can set or change extent attributes on a file by providing the attribute information in the structure of type vx_ext and passing the VX_SETEXT iotcl and the address of the structure using the third argument of the ioctl() call. Applications can also retrieve existing extent attributes, if any, by passing the VX_GETEXT ioctl and the address of the same structure, of type vx_ext, as the third argument with the ioctl() call.

struct vx_ext {

off_t ext_size; /* extent size in fs blocks */

off_t reserve; /* space reservation in fs blocks */

int a_flags; /* allocation flags */

}

The ext_size argument is set to specify a fixed extent size. The value of fixed extent size is specified in units of the file system block size. Be sure the file system block size is known before setting the fixed extent size. If a fixed extent size is not required, use zero to allow the default allocation policy to be used for allocating extents. The fixed extent allocation policy takes effect immediately after successful execution of the VX_SETEXT ioctl. An exception is with files that already contain indirect blocks, in which case the fixed extent policy has no effect unless all current indirect blocks are freed via file truncation.

The reserve argument can be set to specify the amount of space preallocated to a file. The amount is specified in units of the file system block size. Be sure the file system block size is known before setting the preallocation amount. If a file has already been preallocated, its current reservation amount can be changed with the VX_SETEXT ioctl. If the specified reserve amount is greater than the current reservation, the allocation for the file is increased to match the newly specified reserve amount. If the reserve amount is less than the current reservation, the reservation amount is decreased and the allocation is reduced to the newly set reservation amount or the current file size. Note that file preallocation requires root privilege, unless the size of the file is not changed, and the preallocation size cannot be increased beyond the ulimit of the requesting process.

See the VX_CHGSIZE flag.

See the ulimit(2) manual page.