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 2007-07-20 "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
20 allows the caller to directly manipulate the allocated disk space
21 for the file referred to by
23 for the byte range starting at
31 argument determines the operation to be performed on the given range.
32 Currently only one flag is supported for
35 .B FALLOC_FL_KEEP_SIZE
36 This flag allocates and initializes to zero the disk space
37 within the range specified by
41 After a successful call, subsequent writes into this range
42 are guaranteed not to fail because of lack of disk space.
43 Preallocating zeroed blocks beyond the end of the file
44 is useful for optimizing append workloads.
45 Preallocating blocks does not change
46 the file size (as reported by
48 even if it is less than
51 .\" Note from Amit Arora:
52 .\" There were few more flags which were discussed, but none of
53 .\" them have been finalized upon. Here are these flags:
54 .\" FA_FL_DEALLOC, FA_FL_DEL_DATA, FA_FL_ERR_FREE, FA_FL_NO_MTIME,
56 .\" All of the above flags were debated upon and we can not say
57 .\" if any/which one of these flags will make it to the later kernels.
60 .B FALLOC_FL_KEEP_SIZE
61 flag is not specified in
63 the default behavior is almost same as when this flag is specified.
64 The only difference is that on success,
65 the file size will be changed if
67 is greater than the file size.
68 This default behavior closely resembles the behavior of the
69 .BR posix_fallocate (3)
71 and is intended as a method of optimally implementing that function.
73 Because allocation is done in block size chunks,
75 may allocate a larger range than that which was specified.
78 returns zero on success, or an error number on failure.
80 .\" FIXME . the library wrapper function will do the right
81 .\" thing, returning -1 on error and setting errno.
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.
136 .BR posix_fallocate (3),
137 .BR posix_fadvise (3)