1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (c) 2006 Andrew Morton <akpm@osdl.org>
4 .\" and Copyright 2006 Michael Kerrisk <mtk.manpages@gmail.com>
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" 2006-07-05 Initial creation, Michael Kerrisk based on
27 .\" Andrew Morton's comments in fs/sync.c
29 .\" Japanese Version Copyright (c) 2007 Akihiro MOTOKI
30 .\" all rights reserved.
31 .\" Translated 2007-01-09, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.43
32 .\" Updated 2008-08-06, Akihiro MOTOKI, LDP v3.05
33 .\" Updated 2010-04-23, Akihiro MOTOKI, LDP v3.24
35 .TH SYNC_FILE_RANGE 2 2010-01-17 "Linux" "Linux Programmer's Manual"
38 .\"O sync_file_range \- sync a file segment with disk
39 sync_file_range \- ファイルセグメントをディスクと同期する
43 .\"O .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
44 .BR "#define _GNU_SOURCE" " /* feature_test_macros(7) 参照 */"
47 .BI "int sync_file_range(int " fd ", off64_t " offset ", off64_t " nbytes ,
48 .BI " unsigned int " flags );
52 .\"O .BR sync_file_range ()
53 .\"O permits fine control when synchronizing the open file referred to by the
57 .BR sync_file_range ()
60 で参照されるオープンされたファイルのディスクとの同期に関して、
64 .\"O is the starting byte of the file range to be synchronized.
66 .\"O specifies the length of the range to be synchronized, in bytes; if
68 .\"O is zero, then all bytes from
70 .\"O through to the end of file are synchronized.
71 .\"O Synchronization is in units of the system page size:
73 .\"O is rounded down to a page boundary;
74 .\"O .I (offset+nbytes-1)
75 .\"O is rounded up to a page boundary.
77 は、同期を行うファイルの領域の開始バイトである。
79 には同期を行う領域の長さをバイト単位で指定する。
84 同期はシステムのページサイズの単位で行われる。
92 .\"O bit-mask argument can include any of the following values:
97 .B SYNC_FILE_RANGE_WAIT_BEFORE
98 .\"O Wait upon write-out of all pages in the specified range
99 .\"O that have already been submitted to the device driver for write-out
100 .\"O before performing any write.
101 何らかの書き込みを行う前に、指定された領域のページで
102 書き出しを行うようにデバイスドライバにすでに要求が発行されている
105 .B SYNC_FILE_RANGE_WRITE
106 .\"O Initiate write-out of all dirty pages in the specified
107 .\"O range which are not presently submitted write-out.
108 .\"O Note that even this may block if you attempt to
109 .\"O write more than request queue size.
110 指定された領域のページで、書き出し要求が発行されていない
111 全ての dirty (キャッシュだけが変更されている) ページの
113 リクエストキューの大きさより多く書き込もうとした場合には、
114 この処理は停止 (block) する可能性がある点に注意すること。
116 .B SYNC_FILE_RANGE_WAIT_AFTER
117 .\"O Wait upon write-out of all pages in the range
118 .\"O after performing any write.
119 何らかの書き込み後に、指定された領域の全てのページの
124 .\"O as 0 is permitted, as a no-op.
126 に 0 を指定した場合、何もしないことを表す。
129 .\"O This system call is extremely dangerous and should not be used in portable
132 移植性が必要なプログラムで使用すべきではない。
133 .\"O None of these operations writes out the file's metadata.
134 .\"O Therefore, unless the application is strictly performing overwrites of
135 .\"O already-instantiated disk blocks, there are no guarantees that the data will
136 .\"O be available after a crash.
137 これらの操作ではどれもファイルのメタデータの書き出しを行わない。
138 したがって、アプリケーションにより作成済みのディスクブロックの
139 上書きの実行が確実に行われない限り、クラッシュの後でもデータが
141 .\"O There is no user interface to know if a write is purely an overwrite.
142 .\"O On filesystem using copy-on-write semantics (e.g.,
144 .\"O an overwrite of existing allocated blocks is impossible.
145 .\"O When writing into preallocated space,
146 .\"O many filesystems also require calls into the block
147 .\"O allocator, which this system call does not sync out to disk.
148 .\"O This system call does not flush disk write caches and thus does not provide
149 .\"O any data integrity on systems with volatile disk write caches.
150 書き込みが上書きだけであるかを知るためのユーザインタフェースは存在しない。
152 などの) copy-on-write 動作を使ったファイルシステムでは、
153 既存の割り当て済みのブロックに対する上書き自体ができない。
154 前もって割り当てられた領域に書き込みを行う場合、
155 多くのファイルシステムでは block allocator への書き込みも必要となるが、
156 このシステムコールは block allocator のディスクへの同期を行わない。
157 このシステムコールはディスク書き込みキャッシュのフラッシュを
158 行わないので、揮発性のディスク書き込みキャッシュを使ったシステムでは
159 このシステムコールではデータの一貫性を確保できないことになる。
160 .\"O .SS Some details
162 .\"O .B SYNC_FILE_RANGE_WAIT_BEFORE
164 .\"O .B SYNC_FILE_RANGE_WAIT_AFTER
168 .\"O conditions and will return these to the caller.
169 .B SYNC_FILE_RANGE_WAIT_BEFORE
171 .B SYNC_FILE_RANGE_WAIT_AFTER
174 状態を検出し、呼び出し元にこれらの情報を返す。
176 .\"O Useful combinations of the
180 の役に立つビットの組み合わせを以下に示す:
182 .B SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE
183 .\"O Ensures that all pages
184 .\"O in the specified range which were dirty when
185 .\"O .BR sync_file_range ()
186 .\"O was called are placed
187 .\"O under write-out.
188 .\"O This is a start-write-for-data-integrity operation.
190 .BR sync_file_range ()
191 が呼び出された際に dirty であった全てのページが、
193 これは、start-write-for-data-integrity 操作
194 (データ完全性確保のための書き込み開始の操作) である。
196 .B SYNC_FILE_RANGE_WRITE
197 .\"O Start write-out of all dirty pages in the specified range which
198 .\"O are not presently under write-out.
199 .\"O This is an asynchronous flush-to-disk
201 .\"O This is not suitable for data integrity operations.
202 指定された範囲内のページで、現在書き出し中でない全ての dirty ページの
203 書き出しを開始する。これは非同期のディスクへのフラッシュ (flush-to-disk)
204 操作である。データ完全性確保が必要な操作としては適切ではない。
206 .BR SYNC_FILE_RANGE_WAIT_BEFORE " (or " SYNC_FILE_RANGE_WAIT_AFTER )
208 .\"O completion of write-out of all pages in the specified range.
209 .\"O This can be used after an earlier
210 .\"O .B SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE
211 .\"O operation to wait for completion of that operation, and obtain its result.
212 指定された範囲内の全てのページの書き出しの完了を待つ。
214 .B SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE
215 の後に使用でき、この操作の完了を待ち、結果を取得することができる。
217 .B SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | \
218 SYNC_FILE_RANGE_WAIT_AFTER
219 .\"O This is a write-for-data-integrity operation
220 .\"O that will ensure that all pages in the specified range which were dirty when
221 .\"O .BR sync_file_range ()
222 .\"O was called are committed to disk.
223 これは write-for-data-integrity 操作
224 (データ完全性確保のための書き込み) であり、指定された範囲内の、
225 .BR sync_file_range ()
226 が呼ばれた時点で dirty な全てのページが
228 .\"O .SH RETURN VALUE
231 .\"O .BR sync_file_range ()
232 .\"O returns 0; on failure \-1 is returned and
234 .\"O is set to indicate the error.
236 .BR sync_file_range ()
237 は 0 を返す。失敗の場合、\-1 を返し、
245 .\"O is not a valid file descriptor.
251 .\"O specifies an invalid bit; or
272 .\"O Out of disk space.
277 .\"O refers to something other than a regular file, a block device,
278 .\"O a directory, or a symbolic link.
280 が、通常のファイル、ブロックデバイス、ディレクトリ、シンボリックリンク
282 .\" FIXME . (bug?) Actually, how can 'fd' refer to a symbolic link (S_ISLNK)?
283 .\" (In userspace at least) it isn't possible to obtain a file descriptor
284 .\" for a symbolic link.
286 .\"O .BR sync_file_range ()
287 .\"O appeared on Linux in kernel 2.6.17.
288 .BR sync_file_range ()
289 はカーネル 2.6.17 で Linux に登場した。
290 .\"O .SH "CONFORMING TO"
292 .\"O This system call is Linux-specific, and should be avoided
293 .\"O in portable programs.
294 このシステムコールは Linux 独自であり、
295 移植性が必要なプログラムでは使用を避けるべきである。