DFSExpandFile
Requests DFS to expand a file with a range of contiguous blocks
#include <nwdfs.h>
LONG DFSExpandFile (
LONG fileHandle,
LONG fileBlockNumber,
LONG numberOfBlocks,
LONG volumeBlockNumber,
LONG segmentNumber);
The DFSExpandFile function is required to expand a file or to write in a hole in a sparse file ( DFSWrite and DFSWriteNoWait cannot expand a file by writing beyond the current end of the file or by writing in a hole in a sparse file. Also, normal (non-direct) writes which could normally expand a file are rejected by the OS while a file is in direct file mode).
Since it is always possible that DFS might find that some of the blocks in the indicated range have been allocated by other threads or processes after the caller determined that they were free, the caller must handle this contingency. It is logical that the caller repeat the sequence of freeing limbo blocks and attempting to expand several times before reducing the number of contiguous blocks requested and making multiple requests. For details on striping and other allocation details, see Impact of Striping. New file space allocated to fill a hole in a sparse file is zero-filled. Contiguous blocks added to the end of allocated file space are not zero-filled.
NOTE:A range of blocks that spans two volume segments is not considered contiguous, even though the logical volume block addresses are contiguous.