1 .\" Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved
2 .\" Written by Dave Chinner <dgc@sgi.com>
3 .\" May be distributed as per GNU General Public License version 2.
5 .TH FALLOCATE 2 2008-10-06 "Linux" "Linux Programmer's Manual"
7 fallocate \- manipulate file space
10 .\" FIXME . eventually this #include will probably be something
11 .\" different when support is added in glibc.
12 .B #include <linux/falloc.h>
14 .BI "long fallocate(int " fd ", int " mode ", loff_t " offset \
17 .\" FIXME . check later what feature text macros are required in glibc
19 This is a non-portable, Linux-specific system call.
20 For the portable, POSIX.1-specified method of ensuring that space
21 is allocated for a file, see
22 .BR posix_fallocate ().
25 allows the caller to directly manipulate the allocated disk space
26 for the file referred to by
28 for the byte range starting at
36 argument determines the operation to be performed on the given range.
37 Currently only one flag is supported for
40 .B FALLOC_FL_KEEP_SIZE
41 This flag allocates and initializes to zero the disk space
42 within the range specified by
46 After a successful call, subsequent writes into this range
47 are guaranteed not to fail because of lack of disk space.
48 Preallocating zeroed blocks beyond the end of the file
49 is useful for optimizing append workloads.
50 Preallocating blocks does not change
51 the file size (as reported by
53 even if it is less than
56 .\" Note from Amit Arora:
57 .\" There were few more flags which were discussed, but none of
58 .\" them have been finalized upon. Here are these flags:
59 .\" FA_FL_DEALLOC, FA_FL_DEL_DATA, FA_FL_ERR_FREE, FA_FL_NO_MTIME,
61 .\" All of the above flags were debated upon and we can not say
62 .\" if any/which one of these flags will make it to the later kernels.
65 .B FALLOC_FL_KEEP_SIZE
66 flag is not specified in
68 the default behavior is almost same as when this flag is specified.
69 The only difference is that on success,
70 the file size will be changed if
72 is greater than the file size.
73 This default behavior closely resembles the behavior of the
74 .BR posix_fallocate (3)
76 and is intended as a method of optimally implementing that function.
78 Because allocation is done in block size chunks,
80 may allocate a larger range than that which was specified.
83 returns zero on success, and -1 on failure.
88 is not a valid file descriptor, or is not opened for writing.
92 exceeds the maximum file size.
95 A signal was caught during execution.
101 was less than or equal to 0.
104 An I/O error occurred while reading from or writing to a file system.
108 does not refer to a regular file or a directory.
111 is a pipe or FIFO, a different error results.)
114 There is not enough space left on the device containing the file
119 The file system containing the file referred to by
121 does not support this operation.
126 is not supported by the file system containing the file referred to by
130 is available on Linux since kernel 2.6.23.
135 Glibc does not provide a wrapper for this system call; call it using
139 .BR posix_fadvise (3),
140 .BR posix_fallocate (3)