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 .\" Japanese Version Copyright (c) 2007 Akihiro MOTOKI
6 .\" all rights reserved.
7 .\" Translated 2007-10-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.66
8 .\" Updated 2008-10-13, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.11
10 .TH FALLOCATE 2 2009-03-13 "Linux" "Linux Programmer's Manual"
13 .\"O fallocate \- manipulate file space
14 fallocate \- ¥Õ¥¡¥¤¥ë¶õ´Ö¤ÎÁàºî
21 .BI "int fallocate(int " fd ", int " mode ", off_t " offset \
26 .\"O This is a nonportable, Linux-specific system call.
27 .\"O For the portable, POSIX.1-specified method of ensuring that space
28 .\"O is allocated for a file, see
29 .\"O .BR posix_fallocate ().
30 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢°Ü¿¢À¤Î¤Ê¤¤¡¢Linux ¸ÇͤΥ·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¤¢¤ë¡£
31 °Ü¿¢À¤¬É¬Íפʾì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¥Ç¥£¥¹¥¯¶õ´Ö¤ò³Î¼Â¤Ë³ÎÊݤ¹¤ë¤¿¤á¤Ë¡¢
32 POSIX.1 ¤Çµ¬Äꤵ¤ì¤¿ÊýË¡¤Ç¤¢¤ë
33 .BR posix_fallocate (3)
37 .\"O allows the caller to directly manipulate the allocated disk space
38 .\"O for the file referred to by
40 .\"O for the byte range starting at
42 .\"O and continuing for
48 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¥Ç¥£¥¹¥¯¶õ´Ö¤òľÀÜÁàºî¤Ç¤¤ë¡£
57 .\"O argument determines the operation to be performed on the given range.
58 .\"O Currently only one flag is supported for
61 °ú¤¿ô¤Ï¡¢»ØÄꤵ¤ì¤¿Îΰè¤ËÂФ·¤Æ¼Â¹Ô¤¹¤ëÁàºî¤ò»ØÄꤹ¤ë¡£
64 ¤Ë»ØÄê¤Ç¤¤ë¥Õ¥é¥°¤Ï°Ê²¼¤Î°ì¤Ä¤À¤±¤Ç¤¢¤ë¡£
66 .B FALLOC_FL_KEEP_SIZE
67 .\"O This flag allocates and initializes to zero the disk space
68 .\"O within the range specified by
72 .\"O After a successful call, subsequent writes into this range
73 .\"O are guaranteed not to fail because of lack of disk space.
78 ¤Ç»ØÄꤵ¤ì¤¿Îΰè¤Î¥Ç¥£¥¹¥¯¶õ´Ö¤ò³ä¤êÅö¤Æ¡¢¤½¤Î¶õ´Ö¤ò 0 ¤Ç½é´ü²½¤¹¤ë¡£
79 ¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¤È¡¢¤½¤ì¤Ë³¤¤¤Æ¤³¤ÎÎΰè¤Ø¤Î½ñ¤¹þ¤ß¤¬¹Ô¤ï¤ì¤ë¤¬¡¢
80 ¥Ç¥£¥¹¥¯¶õ´Ö¤ÎÉÔ¤ˤè¤ë½ñ¤¹þ¤ß¼ºÇÔ¤¬È¯À¸¤·¤Ê¤¤¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
81 .\"O Preallocating zeroed blocks beyond the end of the file
82 .\"O is useful for optimizing append workloads.
83 .\"O Preallocating blocks does not change
84 .\"O the file size (as reported by
86 .\"O even if it is less than
87 .\"O .IR offset + len .
88 ¥Õ¥¡¥¤¥ëËöÈø¤è¤ê¸å¤í¤ÎÎΰè¤Ë¤Ä¤¤¤Æ 0 ¤ÇËä¤á¤¿¥Ö¥í¥Ã¥¯¤òÁ°¤â¤Ã¤Æ
89 ³ä¤êÅö¤Æ¤Æ¤ª¤¯¤³¤È¤Ï¡¢Äɵ (append) ¤Îºî¶ÈÉé²Ù¤òºÇŬ²½¤¹¤ë¤Î¤Ë
93 ¤è¤ê¤â¾®¤µ¤¤¾ì¹ç¤Ç¤¢¤Ã¤Æ¤â¡¢¥Ö¥í¥Ã¥¯¤ÎÁ°¤â¤Ã¤Æ¤Î³ä¤êÅö¤Æ¤Ë¤è¤ê
95 ¤¬ÊÖ¤¹) ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÏÊѹ¹¤µ¤ì¤ë¤³¤È¤Ï¤Ê¤¤¡£
97 .\" Note from Amit Arora:
98 .\" There were few more flags which were discussed, but none of
99 .\" them have been finalized upon. Here are these flags:
100 .\" FA_FL_DEALLOC, FA_FL_DEL_DATA, FA_FL_ERR_FREE, FA_FL_NO_MTIME,
102 .\" All of the above flags were debated upon and we can not say
103 .\" if any/which one of these flags will make it to the later kernels.
106 .\"O .B FALLOC_FL_KEEP_SIZE
107 .\"O flag is not specified in
109 .\"O the default behavior is almost same as when this flag is specified.
110 .\"O The only difference is that on success,
111 .\"O the file size will be changed if
112 .\"O .I "offset + len"
113 .\"O is greater than the file size.
114 .\"O This default behavior closely resembles the behavior of the
115 .\"O .BR posix_fallocate (3)
116 .\"O library function,
117 .\"O and is intended as a method of optimally implementing that function.
118 .B FALLOC_FL_KEEP_SIZE
121 ¤Ë»ØÄꤵ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¡¢¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï
122 .B FALLOC_FL_KEEP_SIZE
123 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤È¤Û¤È¤ó¤ÉƱ¤¸¤È¤Ê¤ë¡£
126 ¤¬¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤è¤ê¤âÂ礤«¤Ã¤¿¾ì¹ç¡¢¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¤È
127 ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤¬Êѹ¹¤µ¤ì¤ëÅÀ¤Ç¤¢¤ë¡£
128 ¤³¤Î¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï¡¢¥é¥¤¥Ö¥é¥ê´Ø¿ô
129 .BR posix_fallocate (3)
130 ¤ÎÆ°ºî¤ÈÈó¾ï¤Ë»÷¤Æ¤¤¤ë¡£¤³¤ì¤Ï
131 .BR posix_fallocate (3)
132 ¤òºÇŬ¤Ë¼ÂÁõ¤¹¤ë¼êÃʤòÄ󶡤¹¤ë¤³¤È¤òÌÜŪ¤È¤·¤Æ¤¤¤ë¤«¤é¤Ç¤¢¤ë¡£
134 .\"O Because allocation is done in block size chunks,
135 .\"O .BR fallocate ()
136 .\"O may allocate a larger range than that which was specified.
137 ³ä¤êÅö¤Æ¤Ï¥Ö¥í¥Ã¥¯¥µ¥¤¥ºÃ±°Ì¤Ç¹Ô¤ï¤ì¤ë¤¿¤á¡¢
139 ¤Ï»ØÄꤵ¤ì¤¿¤è¤ê¤âÂ礤ÊÎΰè¤ò³ä¤êÅö¤Æ¤ë¤³¤È¤¬¤¢¤ë¡£
140 .\"O .SH RETURN VALUE
142 .\"O .BR fallocate ()
143 .\"O returns zero on success, and -1 on failure.
145 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤¹¡£
151 .\"O is not a valid file descriptor, or is not opened for writing.
153 ¤¬Í¸ú¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¤«¡¢
154 ½ñ¤¹þ¤ßÍѤȤ·¤Æ¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
157 .\"O .IR offset + len
158 .\"O exceeds the maximum file size.
160 ¤¬¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÎºÇÂçÃͤè¤ê¤âÂ礤¤¡£
163 .\"O A signal was caught during execution.
164 ¼Â¹ÔÃæ¤Ë¥·¥°¥Ê¥ë¤¬Ê᪤µ¤ì¤¿¡£
168 .\"O was less than 0, or
170 .\"O was less than or equal to 0.
177 .\"O An I/O error occurred while reading from or writing to a file system.
178 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤È¤ÎÆɤ߽ñ¤Ãæ¤ËÆþ½ÐÎÏ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
182 .\"O does not refer to a regular file or a directory.
185 .\"O is a pipe or FIFO, a different error results.)
187 ¤¬Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤«¥Ç¥£¥ì¥¯¥È¥ê¤ò»²¾È¤·¤Æ¤¤¤Ê¤¤
189 ¤¬¥Ñ¥¤¥×¤ä FIFO ¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¡¢Ê̤Υ¨¥é¡¼¤¬È¯À¸¤¹¤ë)¡£
192 .\"O There is not enough space left on the device containing the file
196 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Ç¥Ð¥¤¥¹¤Ë½½Ê¬¤Ê¶õ¤Îΰ褬¤Ê¤¤¡£
199 .\"O The file system containing the file referred to by
201 .\"O does not support this operation.
203 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
204 »ØÄꤵ¤ì¤¿Áàºî¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£
209 .\"O is not supported by the file system containing the file referred to by
212 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
214 ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£
217 .\"O .BR fallocate ()
218 .\"O is available on Linux since kernel 2.6.23.
219 .\"O Support is provided by glibc since version 2.10.
221 ¤Ï¥«¡¼¥Í¥ë 2.6.23 °Ê¹ß¤Î Linux ¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£
222 glibc ¤Ç¤ÎÂбþ¤Ï¥Ð¡¼¥¸¥ç¥ó 3.10 °Ê¹ß¤Ç¹Ô¤ï¤ì¤Æ¤¤¤ë¡£
223 .\"O .SH CONFORMING TO
225 .\"O .BR fallocate ()
226 .\"O is Linux-specific.
228 ¤Ï Linux ¸ÇͤǤ¢¤ë¡£
232 .BR posix_fadvise (3),
233 .BR posix_fallocate (3)