OSDN Git Service

Update drafts for LDP 3.67
[linuxjm/LDP_man-pages.git] / draft / man2 / fallocate.2
index 371594e..7c270c8 100644 (file)
@@ -22,7 +22,7 @@
 .\" Updated 2013-05-07, Akihiro MOTOKI <amotoki@gmail.com>
 .\" Updated 2013-07-22, Akihiro MOTOKI <amotoki@gmail.com>
 .\"
-.TH FALLOCATE 2 2014\-01\-24 Linux "Linux Programmer's Manual"
+.TH FALLOCATE 2 2014\-05\-08 Linux "Linux Programmer's Manual"
 .SH 名前
 fallocate \- ファイル空間の操作
 .SH 書式
@@ -83,6 +83,54 @@ Btrfs (Linux 3.7 以降)
 .IP *
 .\" commit 83e4fa9c16e4af7122e31be3eca5d57881d236fe
 tmpfs (Linux 3.5 以降)
+.SS ファイル空間の一部削除
+.\" commit 00f5e61998dd17f5375d9dfc01331f104b83f841
+\fBFALLOC_FL_COLLAPSE_RANGE\fP フラグ (Linux 3.15 以降で利用可能) を \fImode\fP に指定すると、
+指定したバイト範囲をファイルから削除する。 その際、ホールを残らない。 削除されるバイト範囲は \fIoffset\fP から始まる \fIlen\fP
+バイトの範囲である。 操作が完了すると、 ファイルの \fIoffset+len\fP の位置から始まる内容が \fIoffset\fP の位置に見えるようになり、
+ファイルのサイズは \fIlen\fP バイトだけ小さくなる。
+
+効率的に動作する実装にするため、ファイルシステムはこの操作の粒度に制限を設けることがある。 通常は \fIoffset\fP と \fIlen\fP
+はファイルシステムの論理ブロックサイズの倍数でなければならない。 論理ブロックサイズはファイルシステムの種類や設定により様々である。
+ファイルシステムにこのような要求条件がある場合、 その要求条件が満たされていなければ、 \fBfallocate\fP はエラー \fBEINVAL\fP
+で失敗する。
+
+\fIoffset\fP と \fIlen\fP で指定された範囲がファイルの末尾かそれより先まで達している場合、 エラーが返される。
+代わりに、ファイルの切り詰めを行う \fBftruncate\fP(2) を使用すること。
+
+\fBFALLOC_FL_COLLAPSE_RANGE\fP と他のフラグを同時に \fImode\fP に指定することはできない。
+
+.\" commit 9eb79482a97152930b113b51dff530aba9e28c8e
+.\" commit e1d8fb88a64c1f8094b9f6c3b6d2d9e6719c970d
+Linux 3.15 時点では \fBFALLOC_FL_COLLAPSE_RANGE\fP は ext4 (エクステントベースのファイル) と XFS
+でサポートされている。
+.SS "Zeroing file space"
+.\" commit 409332b65d3ed8cfa7a8030f1e9d52f372219642
+Specifying the \fBFALLOC_FL_ZERO_RANGE\fP flag (available since Linux 3.14)  in
+\fImode\fP zeroes space in the byte range starting at \fIoffset\fP and continuing
+for \fIlen\fP bytes.  Within the specified range, blocks are preallocated for
+the regions that span the holes in the file.  After a successful call,
+subsequent reads from this range will return zeroes.
+
+Zeroing is done within the filesystem preferably by converting the range
+into unwritten extents.  This approach means that the specified range will
+not be physically zeroed out on the device (except for partial blocks at the
+either end of the range), and I/O is (otherwise) required only to update
+metadata.
+
+If the \fBFALLOC_FL_KEEP_SIZE\fP flag is additionally specified in \fImode\fP, the
+behavior of the call is similar, but the file size will not be changed even
+if \fIoffset\fP+\fIlen\fP is greater than the file size.  This behaviour is the
+same as when preallocating space with \fBFALLOC_FL_KEEP_SIZE\fP specified.
+
+すべてのファイルシステムで \fBFALLOC_FL_ZERO_RANGE\fP がサポートされているわけではない。
+ファイルシステムがこの操作をサポートしていない場合は、 エラーが返る。 この操作は少なくとも以下のファイルシステムでサポートされている。
+.IP * 3
+.\" commit 376ba313147b4172f3e8cf620b9fb591f3e8cdfa
+XFS (Linux 3.14 以降)
+.IP *
+.\" commit b8a8684502a0fc852afa0056c6bb2a9273f6fcc0
+ext4, for extent\-based files (since Linux 3.14)
 .SH 返り値
 成功の場合、 \fBfallocate\fP() は 0 を返す。 エラーの場合、\-1 を返し、 \fIerror\fP にエラーを示す値を設定する。
 .SH エラー
@@ -105,6 +153,29 @@ tmpfs (Linux 3.5 以降)
 .\" http://thread.gmane.org/gmane.linux.file-systems/48331/focus=1193526
 \fIoffset\fP が 0 未満だったか、 \fIlen\fP が 0 以下だった。
 .TP 
+\fBEINVAL\fP
+\fImode\fP が \fBFALLOC_FL_COLLAPSE_RANGE\fP で、 \fIoffset\fP と \fIlen\fP
+で指定された範囲がファイルの末尾かそれより先まで達している。
+.TP 
+\fBEINVAL\fP
+\fImode\fP が \fBFALLOC_FL_COLLAPSE_RANGE\fP だが、 \fIoffset\fP か \fIlen\fP
+のいずれかがファイルシステムのブロックサイズの倍数ではない。
+.TP 
+\fBEINVAL\fP
+\fImode\fP に \fBFALLOC_FL_COLLAPSE_RANGE\fP と他のフラグの両方が指定されている。
+\fBFALLOC_FL_COLLAPSE_RANGE\fP と他のフラグを一緒に使うことができない。
+.TP 
+\fBEINVAL\fP
+.\" There was a inconsistency in 3.15-rc1, that should be resolved so that all
+.\" filesystems use this error for this case. (Tytso says ex4 will change.)
+.\" http://thread.gmane.org/gmane.comp.file-systems.xfs.general/60485/focus=5521
+.\" From: Michael Kerrisk (man-pages <mtk.manpages@...>
+.\" Subject: Re: [PATCH v5 10/10] manpage: update FALLOC_FL_COLLAPSE_RANGE flag in fallocate
+.\" Newsgroups: gmane.linux.man, gmane.linux.file-systems
+.\" Date: 2014-04-17 13:40:05 GMT
+\fImode\fP が \fBFALLOC_FL_COLLAPSE_RANGE\fP か \fBFALLOC_FL_ZERO_RANGE\fP だが、 \fIfd\fP
+が参照しているファイルが通常のファイルではない。
+.TP 
 \fBEIO\fP
 ファイルシステムとの読み書き中に入出力エラーが発生した。
 .TP 
@@ -124,11 +195,14 @@ tmpfs (Linux 3.5 以降)
 .TP 
 \fBEPERM\fP
 \fIfd\fP が参照するファイルに変更不可 (immutable) の属性が付いている (\fBchattr\fP(1) 参照)。 \fImode\fP に
-\fBFALLOC_FL_PUNCH_HOLE\fP ã\81\8cæ\8c\87å®\9aã\81\95ã\82\8cã\81\9fã\81\8cã\80\81 \fIfd\fP ã\81\8cå\8f\82ç\85§ã\81\99ã\82\8bã\83\95ã\82¡ã\82¤ã\83«ã\81«è¿½å\8a ã\81®ã\81¿ (append\-only)
-の属性が付いている (\fBchattr\fP(1) 参照)。
+\fBFALLOC_FL_PUNCH_HOLE\fP ã\81\8b \fBFALLOC_FL_COLLAPSE_RANGE\fP ã\81\8cæ\8c\87å®\9aã\81\95ã\82\8cã\81\9fã\81\8cã\80\81 \fIfd\fP
\81\8cå\8f\82ç\85§ã\81\99ã\82\8bã\83\95ã\82¡ã\82¤ã\83«ã\81«è¿½å\8a ã\81®ã\81¿ (append\-only) ã\81®å±\9eæ\80§ã\81\8cä»\98ã\81\84ã\81¦ã\81\84ã\82\8b (\fBchattr\fP(1) å\8f\82ç\85§)ã\80\82
 .TP 
 \fBESPIPE\fP
 \fIfd\fP がパイプか FIFO を参照している。
+.TP 
+\fBETXTBSY\fP
+\fImode\fP に \fBFALLOC_FL_COLLAPSE_RANGE\fP が指定されたが、 \fIfd\fP が参照するファイルは現在実行中である。
 .SH バージョン
 .\" See http://sourceware.org/bugzilla/show_bug.cgi?id=14964
 \fBfallocate\fP()  はカーネル 2.6.23 以降の Linux で利用可能である。 glibc での対応はバージョン 3.10
@@ -138,6 +212,6 @@ tmpfs (Linux 3.5 以降)
 .SH 関連項目
 \fBfallocate\fP(1), \fBftruncate\fP(2), \fBposix_fadvise\fP(3), \fBposix_fallocate\fP(3)
 .SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.64 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
 である。プロジェクトの説明とバグ報告に関する情報は
 http://www.kernel.org/doc/man\-pages/ に書かれている。