私はマン・ページをfallocateにしていますが、これらの違いは分かりません。 1つはブロックを割り当てるように見えるが、それらを書くことなく、他はブロックを上書きせずに割り当てを解除するようだ。どちらの方法でも、効果はユーザーの視点と区別できないようです。私に説明してください。モード (Linuxの3.15から利用可能)FALLOC_FL_ZERO_RANGEフラグを指定するファイル・スペースをゼロ パンチ穴とゼロ点の差
オフセットで開始し がlenバイトの継続バイトの範囲内にスペースをゼロ。指定された範囲内では、ファイル内の穴をまたぐ領域に対してブロックが事前に割り当てられます( )。 呼び出しが成功すると、この範囲からの後続の読み取りは、 のゼロを返します。
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 FALLOC_FL_KEEP_SIZE flag is additionally specified in mode, the behavior of the call is similar, but the file size will not be changed even if offset+len is greater than the file size. This behavior is the same as when preallocating space with FALLOC_FL_KEEP_SIZE specified. Not all filesystems support FALLOC_FL_ZERO_RANGE; if a filesystem doesn't support the operation, an error is returned. The operation is supported on at least the following filesystems: * XFS (since Linux 3.15) * ext4, for extent-based files (since Linux 3.15) * SMB3 (since Linux 3.17)
既存のデータを上書きせず ファイルサイズ内のホールを挿入してファイル・スペースを増加させるモードにする(Linux 4.1から利用可能)FALLOC_FL_INSERT_RANGEフラグを指定するファイル・スペース を増やします。ホールはオフセットで を開始し、lenバイトの間継続します。 ファイルの中に穴を挿入すると、オフセットから始まるファイルの内容は、lenバイトだけ を上に(すなわち、より高いファイルオフセットに)シフトされます。ファイル内に の穴を挿入すると、ファイルサイズがlenバイト増加します。
This mode has the same limitations as FALLOC_FL_COLLAPSE_RANGE regarding the granularity of the operation. If the granularity requirements are not met, fallocate() will fail with the error EINVAL. If the offset is equal to or greater than the end of file, an error is returned. For such operations (i.e., inserting a hole at the end of file), ftruncate(2) should be used. No other flags may be specified in mode in conjunction with FALLOC_FL_INSERT_RANGE. FALLOC_FL_INSERT_RANGE requires filesystem support. Filesystems that support this operation include XFS (since Linux 4.1) and ext4 (since Linux 4.2).