Re: [PATCH 1/5] fallocate() implementation in i86, x86_64 and powerpc
From: David Chinner
Date: Wed Jun 13 2007 - 19:53:01 EST
On Tue, Jun 12, 2007 at 11:46:52AM +0530, Amit K. Arora wrote:
> Did you get time to write the above man page ? It will help to push
> further patches in time (eg. for FA_PREALLOCATE mode).
First pass is attached.
`nroff -man fallocate.2 | less` to view.
SGI Australian Software Group
.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 three 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 the underlying disk space with 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)