Extents are used to keep track of file data. An extent contains the start block
number and the number of blocks which the data spans. Extents are linked in a double
linked list. The order of the list is important. The first Extent in the list
points to the first bit of data contained in a specific file. Every following extent
in the list provides information on parts located further in the file.
Extents are structures stored in a B-Tree (and are at the moment also the only
structures stored in a B-Tree). The standard BNodeContainer blocks are used for this
purpose. The location of the root of the Extent B-Tree is stored in the Root
ObjectContainer.
To store Extents in the BNodeContainers a special ExtentBNode structure has been
created to store information about Extents in the leaf nodes of the Extent B-Tree.
This structure is based on the BNode structure and is described
below:
Field |
Type |
Description |
key |
ULONG |
The key value of this ExtentBNode. In the case of Extents this
represents the first block number of the region of blocks this Extent controls. All
keys in the Extent B-Tree are block numbers. |
next |
ULONG |
The key value of the next ExtentBNode in this chain of extents.
Zero indicates tehre is no next ExtentBNode. |
prev |
ULONG |
When the MSB (most significant bit) is cleared, this is the key value of
the previous ExtentBNode. If the MSB is set then the value is the ObjectNode number
of the file to which this Extent chain belongs. |
blocks |
UWORD |
The size (in blocks) of the block region pointed to by the key field. |
struct fsExtentBNode {
ULONG key;
ULONG next;
ULONG prev;
UWORD blocks;
};
|