Following is the modified version of the manpage originally submitted by
David Chinner. Please use `nroff -man fallocate.2 | less` to view.
.TH fallocate 2
fallocate \- allocate or remove file space
.B #include <sys/syscall.h>
.BI "int syscall(int, int fd, int mode, loff_t offset, loff_t len);
syscall allows a user to directly manipulate the allocated disk space
for the file referred to by
for the byte range starting at
and continuing for
parameter determines the operation to be performed on the given range.
Currently there are four modes:
allocates and initialises to zero the disk space within the given range.
After a successful call, subsequent writes are guaranteed not to fail because
of lack of disk space. If the size of the file is less than
.IR offset + len ,
then the file is increased to this size; otherwise the file size is left
and is intended as a method of optimally implementing this function.
may allocate a larger range that was specified.
provides the same functionality as
except it does not ever change the file size. This allows allocation
of zero blocks beyond the end of file and is useful for optimising
removes any preallocated space within the given range. The file size
may change if deallocation is towards the end of the file.
removes the underlying disk space within the given range. The disk space
shall be removed regardless of it's contents so both allocated space
as well as from
will be removed.
shall never remove disk blocks outside the range specified.
shall never change the file size. If changing the file size
is required when deallocating blocks from an offset to end
of file (or beyond end of file) is required,
should be used.
.SH "RETURN VALUE"
returns zero on success, or an error number on failure.
is not set.
is not a valid file descriptor, or is not opened for writing.
exceeds the maximum file size.
was less than 0.
does not refer to a regular file or a directory.
There is not enough space left on the device containing the file
referred to by
refers to a pipe of file descriptor.
The filesystem underlying the file descriptor does not support this
.BR fallocate ()
system call is available since 2.6.XX
.SH "SEE ALSO"
.BR syscall (2),
.BR posix_fadvise (3)
.BR ftruncate (3)