Term | Meaning |
---|---|
new map | Used to define a specific map type supported by FileCore |
zone | Discs are dvidided into a number of zones, each of which is contiguous section of the disc |
nzones | The number of zones on a disc |
map block | Each sector of the map is known as a map block, and controls the allocation of a zone of the disc |
ZoneCheck | Check byte for a zone’s map block. Is used to check that this zone’s map block is valid |
FreeLink | Link to first free fragment in a specific zone. Is a fragment block giving the offset to the first free space fragment block in the allocation bytes |
CrossCheck | Cross check byte for complete map. They are combined to check that the whole map is self-consistent |
A disc has a section of information defined as a Map. It controls the allocation of the disc to the files and directories.
Map | Information Stored | Compaction Required | Recovery Story |
---|---|---|---|
New | Space allocation | No | Two copies stored |
The type of map used is dependent on the format of the disc. These are detailed here.
The advantages of the New map discs are:
The numbering of zones start at 0, and successively contain higher numbered sectors on a disc. The map’s length is nzones × sectors long.
Zone Number | Detail |
---|---|
0 | Contains the lowest numbered sectors on the disc |
1 | |
2 | |
… | |
nzones – 2 | |
nzones – 1 | Contains the highest numbered sectors on the disc |
The location of the map is stored in the middle zone, or as close to the middle as possible, based on whether the number of zones are odd or even. The map’s location is: nzones/2 (rounded down).
So a disc where nzones = 99, the map’s location is at the start of zone 49
A disc where nzones = 100, the map’s location is at the start of zone 50
The map block controls the allocation of a zone of the disc. The first map block controls zone 0, the second controls zone 1, and so on.
The general format of a map block is:
Contents | Notes |
---|---|
Header | |
Disc Record | The Disc Record is only stored in Zone 0 |
Allocation Bytes | |
Unused |
Offset | Name | Meaning |
---|---|---|
0 | ZoneCheck | Check byte for this zone’s map block |
1 | FreeLink | Link to first free fragment in this zone |
3 | CrossCheck | Cross check byte for complete map |
Multiple Disc Record Types are supported by FileCore. The Current default used by FileCore is the Large Disc Record Type.
The Allocation Byte is the part of the map block that controls the allocation of a zone. Together, the allocation bytes from all the map block control the allocation of the whole disc. Each bit corresponds to an allocation unit on the disc.
The size of an allocation unit is defined in the disc record by log2bpmb, and so must be a power of two bytes. An allocation unit is not necessarily one sector – it may be smaller or larger.
Not only must space be logically mapped in whole allocation units; it must also be physically allocated in whole sectors. Consequently, the smallest unit by which allocation may be changed is the larger of the sector size and the allocation unit. This unit is known as the granularity.
A disc is split into a number of disc objects, each of which consists of one or more fragments spread over the surface of the disc. Fragments need not be held in the same zone, and their size can vary by whole units of granularity. Fragments have a minimum size, which is explained below:
Three disc objects are special, and contain:
All other disc objects contain either a directory (optionally with small files held within that directory), or one or more files that are held in a common disc object.
The allocation bytes are treated as an array of bits, with the lsb of a byte coming before the msb in the array.
The array is split into a series of fragment blocks, each representing a fragment.
Since each bit in the array corresponds with an allocation unit on the disc, the length of the fragment block (in bits) must be the same as the size of the fragment (in allocation units). The stream of 0 bits are used to pad the fragment block to the correct length, and the 1 bit to terminate the fragment block.
There are two fragment IDs with special meanings:
ID # | Meaning |
---|---|
1 | Represents the object which contains all bad sectors, and the spare piece of map which hangs over the real end of the disc |
2 | Represents the object which contains the boot block, the map, and the root directory |
Other fragment IDs represent either free space fragments, or allocated fragments:
The chain hence always runs from the beginning of the map block to the end. The offset to the first free space fragment block is given by the FreeLink fragment block in the map block’s header. Because that fragment block is 2 bytes long, and must have a terminating 1 bit, idlen cannot be greater than 15.
Therefore, the following deductions can be made:
This is because a fragment block cannot be smaller that idlen + 1 bits (the fragment id, and the terminating 1 bit)
This is to ensure that it is large enough to hold the maximum possible bit offset to the next free fragment block.