Disk space is allocated in 1024-byte sectors to form logical
blocks. VxFS supports logical block sizes of 1024, 2048, 4096, and
8192 bytes. The default block size is 1K for file systems up to
8 GB, 2K for file systems up to 16 GB, 4K for file systems up to
32 GB, and 8K for file systems beyond this size.
An extent is defined as one or more adjacent blocks of data
within the file system. An extent is presented as an address-length pair, which identifies the starting block address
and the length of the extent (in file system or logical blocks).
VxFS allocates storage in groups of extents rather than a block
at a time (as seen in the HFS file system).
Extents allow disk I/O to take place in units of multiple
blocks if storage is allocated in consecutive blocks. For sequential
I/O, multiple block operations are considerably faster than block-at-a-time
operations; almost all disk drives accept I/O operations of multiple
blocks.
The Extent allocation only slightly alters the interpretation
of addressed blocks from the inode structure compared to block based
inodes. HFS file system inode structure contains the addresses of
12 direct blocks, one indirect block, and one double indirect block.
An indirect block contains the addresses of other blocks. The HFS
indirect block size is 8K and each address is 4 bytes long. HFS
inodes therefore can address 12 blocks directly and up to 2048 more
blocks through one indirect address.
A VxFS inode is similar to the HFS inode and references 10
direct extents, each of which are pairs of starting block addresses
and lengths in blocks. The VxFS inode also points to two indirect
address extents, which contain the addresses of other extents:
The first indirect address extent is used for single
indirection; each entry in the extent indicates the starting block
number of an indirect data extent.
The second indirect address extent is used for double
indirection; each entry in the extent indicates the starting block
number of a single indirect address extent.
Each indirect address extent is 8K long and contains 2048
entries. All indirect data extents for a file must be the same size;
this size is set when the first indirect data extent is allocated
and stored in the inode. Directory inodes always use an 8K indirect
data extent size. Regular file inodes also use an 8K default indirect
data extent size but allocate the indirect data extents in clusters
to simulate larger extents.
Typed Extents |
 |
 |
 |  |
 |
 | NOTE: The information in this section applies to the VxFS
Version 3 and 4 disk layout. |
 |
 |  |
 |
In Version 3 and 4, VxFS introduced a new inode block map
organization for indirect extents known as typed extents. Each entry in the block map has a typed descriptor
record containing a type, offset, starting block, and number of
blocks.
Indirect and data extents use this format to identify logical
file offsets and physical disk locations of any given extent. The
extent descriptor fields are defined as follows:
type | Uniquely identifies an
extent descriptor record and defines the record's length and format. |
offset | Represents the logical
file offset in blocks for a given descriptor. Used to optimize lookups
and eliminate hole descriptor entries. |
starting
block | The starting file system
block of the extent. |
number of
blocks | The number of contiguous
blocks in the extent. |
Indirect address blocks are fully
typed and may have variable lengths up to a maximum and optimum
size of 8K. On a fragmented file system, indirect extents may be
smaller than 8K depending on space availability. VxFS always tries
to obtain 8K indirect extents but resorts to smaller indirects if
necessary.
Indirect Data extents are variable in size to allow
files to allocate large, contiguous extents and take full advantage
of VxFS's optimized I/O.
Holes in sparse files require no storage and are
eliminated by typed records. A hole is determined by adding the
offset and length of a descriptor and comparing the result with
the offset of the next record.
While there are no limits on the levels of indirection,
lower levels are expected in this format since data extents have
variable lengths.
This format uses a type indicator that determines
its record format and content and accommodates new requirements
and functionality for future types.
The current typed format is used on regular files only when
indirection is needed. Typed records are longer than the previous
format and require less direct entries in the inode. Newly created
files start out using the old format which allows for ten direct
extents in the inode. The inode's block map is converted to the
typed format when indirection is needed to offer the advantages
of both formats.