dfs_extend

Requests DFS to expand a file with a range of contiguous blocks.

Library:LibC
Classification:Novell
Service:Direct File System

Syntax

  #include <dfs.h>  
   
  int dfs_extend (
     int   fildes,
     int   fileBlockNum,
     int   blockCount,
     int   volBlockNum,
     int   segNum ); 
  

Parameters

fildes

(IN) Specifies the file handle returned from a prior dfs_sopen or dfs_creat call.

fileBlockNum

(IN) Specifies the beginning file logical block number where the additional contiguous space is to be allocated.

blockCount

(IN) Specifies the number of contiguous blocks requested to be linked into the file allocation at the starting location.

volBlockNum

(IN) Specifies the beginning volume logical block number at which contiguous blocks are to be allocated for the file. A wildcard value of -1 indicates that DFS can allocate the blocks anywhere it can find the required contiguous space on the volume segment.

segNum

(IN) Specifies the volume segment number where the contiguous blocks are to be allocated. A wildcard value of -1 in this parameter indicates that DFS can allocate the blocks in any volume segment on the volume where the specified number of contiguous free blocks can be found.

Return Values

If successful, returns 0. Otherwise, returns a nonzero error code:

Decimal

Constant

Description

4

EBADF

The fildes parameter isn't a valid file descriptor.

79

ENOTSUP

The NLM is loaded in protected address space. This operation is supported only in kernel address space.

106

ENOCONTEXT

The current thread has not context.

For possible DFS errors, see Section 13.4.5, DFS Return Values.

Remarks

The dfs_extend function is required to expand a file or to write in a hole in a sparse file. The dfs_write and dfs_writenowait functions 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.

See Also

dfs_freelimbospace