VOP_ALLOCATE(9) FreeBSD Kernel Developer’s Manual VOP_ALLOCATE(9)
VOP_ALLOCATE — manage storage for a file
VOP_ALLOCATE(struct vnode *vp, int mode, off_t *offset, off_t *len);
This call manipulates allocated storage for a range of offsets in a file. It is used to implement the posix_fallocate(2) and fallocate(2) system calls.
Its arguments are:
The vnode of the file.
The operation to be performed on the given range.
The start of the range to be manipulated in the file.
The length of the range to be manipulated in the file.
The mode argument specifies operation to be performed. Supported modes:
Allocate the disk space. The file’s contents are not changed. Upon successful completion of the operation subsequent writes into the processed range are guranteed not to fail due to the insufficient disk space. A partial allocation is considered a successful operation. The offset and len arguments are updated to reflect the portion of the range that has not been processed yet on return.
De-allocate the disk space, i.e. create a hole. The file’s size is not changed. Upon successful completion of the operation subsequent reading from the processed range is guranteed to return zeroes. Partial completion is only permitted on some fatal error, in which case both offset and len shall be updated to reflect a portion of the original range that has not been processed and proper error code is returned by the VOP_ALLOCATE(). Whether or not disk space is actually reclaimed may depend on file system implementation details, its configuration, alignment of the range with respect to the physical block(s), etc.
The file should be exclusively locked on entry and will still be locked on exit.
Zero is returned if the call is successful, otherwise an appropriate error code is returned.
An attempt was made to write a file that exceeds the process’s file size limit or the maximum file size.
The file system is full.
An append-only flag is set on the file, but the caller is attempting to write before the current end of file.
The requested operation is not supported by the underlying filesystem (
FALLOC_FL_PUNCH_HOLE mode only ).
vnode(9), VOP_READ(9), VOP_WRITE(9)
FreeBSD 10.2 October 3, 2013 FreeBSD 10.2