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 2010-09-10 "Linux" "Linux Programmer's Manual"
13 .\"O fallocate \- manipulate file space
14 fallocate \- ¥Õ¥¡¥¤¥ë¶õ´Ö¤ÎÁàºî
18 .\"O .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
19 .BR "#define _GNU_SOURCE" " /* feature_test_macros(7) »²¾È */"
22 .BI "int fallocate(int " fd ", int " mode ", off_t " offset \
27 .\"O This is a nonportable, Linux-specific system call.
28 .\"O For the portable, POSIX.1-specified method of ensuring that space
29 .\"O is allocated for a file, see
30 .\"O .BR posix_fallocate ().
31 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢°Ü¿¢À¤Î¤Ê¤¤¡¢Linux ¸ÇͤΥ·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¤¢¤ë¡£
32 °Ü¿¢À¤¬É¬Íפʾì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¥Ç¥£¥¹¥¯¶õ´Ö¤ò³Î¼Â¤Ë³ÎÊݤ¹¤ë¤¿¤á¤Ë¡¢
33 POSIX.1 ¤Çµ¬Äꤵ¤ì¤¿ÊýË¡¤Ç¤¢¤ë
34 .BR posix_fallocate (3)
38 .\"O allows the caller to directly manipulate the allocated disk space
39 .\"O for the file referred to by
41 .\"O for the byte range starting at
43 .\"O and continuing for
49 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¥Ç¥£¥¹¥¯¶õ´Ö¤òľÀÜÁàºî¤Ç¤¤ë¡£
58 .\"O argument determines the operation to be performed on the given range.
59 .\"O Currently only one flag is supported for
62 °ú¤¿ô¤Ï¡¢»ØÄꤵ¤ì¤¿Îΰè¤ËÂФ·¤Æ¼Â¹Ô¤¹¤ëÁàºî¤ò»ØÄꤹ¤ë¡£
65 ¤Ë»ØÄê¤Ç¤¤ë¥Õ¥é¥°¤Ï°Ê²¼¤Î°ì¤Ä¤À¤±¤Ç¤¢¤ë¡£
67 .B FALLOC_FL_KEEP_SIZE
68 .\"O This flag allocates and initializes to zero the disk space
69 .\"O within the range specified by
73 .\"O After a successful call, subsequent writes into this range
74 .\"O are guaranteed not to fail because of lack of disk space.
79 ¤Ç»ØÄꤵ¤ì¤¿Îΰè¤Î¥Ç¥£¥¹¥¯¶õ´Ö¤ò³ä¤êÅö¤Æ¡¢¤½¤Î¶õ´Ö¤ò 0 ¤Ç½é´ü²½¤¹¤ë¡£
80 ¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¤È¡¢¤½¤ì¤Ë³¤¤¤Æ¤³¤ÎÎΰè¤Ø¤Î½ñ¤¹þ¤ß¤¬¹Ô¤ï¤ì¤ë¤¬¡¢
81 ¥Ç¥£¥¹¥¯¶õ´Ö¤ÎÉÔ¤ˤè¤ë½ñ¤¹þ¤ß¼ºÇÔ¤¬È¯À¸¤·¤Ê¤¤¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
82 .\"O Preallocating zeroed blocks beyond the end of the file
83 .\"O is useful for optimizing append workloads.
84 .\"O Preallocating blocks does not change
85 .\"O the file size (as reported by
87 .\"O even if it is less than
88 .\"O .IR offset + len .
89 ¥Õ¥¡¥¤¥ëËöÈø¤è¤ê¸å¤í¤ÎÎΰè¤Ë¤Ä¤¤¤Æ 0 ¤ÇËä¤á¤¿¥Ö¥í¥Ã¥¯¤òÁ°¤â¤Ã¤Æ
90 ³ä¤êÅö¤Æ¤Æ¤ª¤¯¤³¤È¤Ï¡¢Äɵ (append) ¤Îºî¶ÈÉé²Ù¤òºÇŬ²½¤¹¤ë¤Î¤Ë
94 ¤è¤ê¤â¾®¤µ¤¤¾ì¹ç¤Ç¤¢¤Ã¤Æ¤â¡¢¥Ö¥í¥Ã¥¯¤ÎÁ°¤â¤Ã¤Æ¤Î³ä¤êÅö¤Æ¤Ë¤è¤ê
96 ¤¬ÊÖ¤¹) ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÏÊѹ¹¤µ¤ì¤ë¤³¤È¤Ï¤Ê¤¤¡£
98 .\" Note from Amit Arora:
99 .\" There were few more flags which were discussed, but none of
100 .\" them have been finalized upon. Here are these flags:
101 .\" FA_FL_DEALLOC, FA_FL_DEL_DATA, FA_FL_ERR_FREE, FA_FL_NO_MTIME,
103 .\" All of the above flags were debated upon and we can not say
104 .\" if any/which one of these flags will make it to the later kernels.
107 .\"O .B FALLOC_FL_KEEP_SIZE
108 .\"O flag is not specified in
110 .\"O the default behavior is almost same as when this flag is specified.
111 .\"O The only difference is that on success,
112 .\"O the file size will be changed if
113 .\"O .I "offset + len"
114 .\"O is greater than the file size.
115 .\"O This default behavior closely resembles the behavior of the
116 .\"O .BR posix_fallocate (3)
117 .\"O library function,
118 .\"O and is intended as a method of optimally implementing that function.
119 .B FALLOC_FL_KEEP_SIZE
122 ¤Ë»ØÄꤵ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¡¢¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï
123 .B FALLOC_FL_KEEP_SIZE
124 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤È¤Û¤È¤ó¤ÉƱ¤¸¤È¤Ê¤ë¡£
127 ¤¬¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤è¤ê¤âÂ礤«¤Ã¤¿¾ì¹ç¡¢¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¤È
128 ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤¬Êѹ¹¤µ¤ì¤ëÅÀ¤Ç¤¢¤ë¡£
129 ¤³¤Î¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï¡¢¥é¥¤¥Ö¥é¥ê´Ø¿ô
130 .BR posix_fallocate (3)
131 ¤ÎÆ°ºî¤ÈÈó¾ï¤Ë»÷¤Æ¤¤¤ë¡£¤³¤ì¤Ï
132 .BR posix_fallocate (3)
133 ¤òºÇŬ¤Ë¼ÂÁõ¤¹¤ë¼êÃʤòÄ󶡤¹¤ë¤³¤È¤òÌÜŪ¤È¤·¤Æ¤¤¤ë¤«¤é¤Ç¤¢¤ë¡£
135 .\"O Because allocation is done in block size chunks,
136 .\"O .BR fallocate ()
137 .\"O may allocate a larger range than that which was specified.
138 ³ä¤êÅö¤Æ¤Ï¥Ö¥í¥Ã¥¯¥µ¥¤¥ºÃ±°Ì¤Ç¹Ô¤ï¤ì¤ë¤¿¤á¡¢
140 ¤Ï»ØÄꤵ¤ì¤¿¤è¤ê¤âÂ礤ÊÎΰè¤ò³ä¤êÅö¤Æ¤ë¤³¤È¤¬¤¢¤ë¡£
141 .\"O .SH RETURN VALUE
143 .\"O .BR fallocate ()
144 .\"O returns zero on success, and -1 on failure.
146 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤¹¡£
152 .\"O is not a valid file descriptor, or is not opened for writing.
154 ¤¬Í¸ú¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¤«¡¢
155 ½ñ¤¹þ¤ßÍѤȤ·¤Æ¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
158 .\"O .IR offset + len
159 .\"O exceeds the maximum file size.
161 ¤¬¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÎºÇÂçÃͤè¤ê¤âÂ礤¤¡£
164 .\"O A signal was caught during execution.
165 ¼Â¹ÔÃæ¤Ë¥·¥°¥Ê¥ë¤¬Ê᪤µ¤ì¤¿¡£
169 .\"O was less than 0, or
171 .\"O was less than or equal to 0.
178 .\"O An I/O error occurred while reading from or writing to a file system.
179 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤È¤ÎÆɤ߽ñ¤Ãæ¤ËÆþ½ÐÎÏ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
183 .\"O does not refer to a regular file or a directory.
186 .\"O is a pipe or FIFO, a different error results.)
188 ¤¬Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤«¥Ç¥£¥ì¥¯¥È¥ê¤ò»²¾È¤·¤Æ¤¤¤Ê¤¤
190 ¤¬¥Ñ¥¤¥×¤ä FIFO ¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¡¢Ê̤Υ¨¥é¡¼¤¬È¯À¸¤¹¤ë)¡£
193 .\"O There is not enough space left on the device containing the file
197 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Ç¥Ð¥¤¥¹¤Ë½½Ê¬¤Ê¶õ¤Îΰ褬¤Ê¤¤¡£
200 .\"O The file system containing the file referred to by
202 .\"O does not support this operation.
204 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
205 »ØÄꤵ¤ì¤¿Áàºî¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£
210 .\"O is not supported by the file system containing the file referred to by
213 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
215 ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£
218 .\"O .BR fallocate ()
219 .\"O is available on Linux since kernel 2.6.23.
220 .\"O Support is provided by glibc since version 2.10.
222 ¤Ï¥«¡¼¥Í¥ë 2.6.23 °Ê¹ß¤Î Linux ¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£
223 glibc ¤Ç¤ÎÂбþ¤Ï¥Ð¡¼¥¸¥ç¥ó 3.10 °Ê¹ß¤Ç¹Ô¤ï¤ì¤Æ¤¤¤ë¡£
224 .\"O .SH CONFORMING TO
226 .\"O .BR fallocate ()
227 .\"O is Linux-specific.
229 ¤Ï Linux ¸ÇͤǤ¢¤ë¡£
233 .BR posix_fadvise (3),
234 .BR posix_fallocate (3)