2.1.1 Block Allocation Structure Fields

Alloc[...]
A variable length array of structures. Each structure in the array contains the following members.

Status
The status of this space allocation. Indicates both the position and condition of the specific space allocation within the block. All bits not specifically defined in this Status member must be ones.

The position status indicates the relative position of this specific Alloc entry in the variable length array of Alloc structures.

Position

Status Value

Definition

1xxxxxxxb

Last member of the variable length Alloc structure array.

0xxxxxxxb

Not last member of the variable length Alloc structure array.


The condition status indicates whether the space described by this Alloc entry is either allocated and active, allocated but superseded (freed), or deallocated and can be reclaimed.

Condition

Status Value

Definition

x111xxxxb

Free member of the Alloc structure array. This is a member that was freed up during a block reclamation operation but cannot be converted to unused because other Alloc entries follow it. However, this member may be reused.

x011xxxxb

Allocated member of the allocation structure array. The region within the block described by this entry is currently active and cannot be reclaimed.

x001xxxxb

Deallocated member of the allocation structure array. The region described by a deallocated member can be reclaimed. An allocation structure array entry changes from 'allocated' to 'deallocated' status when the region it describes is deleted or completely modified.

x000xxxxb

Null member of the allocation structure array. A problem previously occurred when trying to write to this Alloc entry. It has been marked NULL so that it is not used again. It may become reusable during the next block reclamation process run on this block.


StatusValue

Definition

xxxx1111b

Reserved. Must be ones


Offset
Offset, relative to the beginning of the block, of this space allocation.

Len
Length, in bytes, of this space allocation.

BootRecordPtr
A pointer to the boot record for this partition. The Boot Record status bits determines whether the pointer stored here is valid or is to be considered FNULL.

EraseCount
The number of times that this block has been erased. The Erase Count should be 1 after the partition is formatted for the first time. Each time a block is erased, the erase count is updated by the file system.

BlockSeq
The block's sequence within the partition. The file system views a partition as a sequence of logically contiguous blocks. The block sequence enables the file system to translate a blocks logical position within the sequence of blocks to the actual physical location of a block within the partition.

The spare block defined later in this section will have a BlockSeq and BlockSeqChecksum of all 1's (FFFFh).

BlockSeqChecksum

This block's sequence checksum. This is simply the one's complement of the BlockSeq. A block's contents are valid only if:

BlockSeq ^ BlockSeqChecksum == 0xffff

If this relationship is not true, the block contains no valid information. The block is either blank or has been corrupted by removal of the memory media while it was being erased. If a block's contents are corrupt it is queued for erasure by the file system. This check is included as yet another fail-safe measure to detect blocks that have been corrupted by removal of the media at some point within an erase cycle. A simple checksum is used for the sake of efficiency.

Note that the BlockSeqChecksum value for the 'spare' block is an exception to the above algorithm. The 'spare' block defined later in this section will have a BlockSeqChecksum of all 1's (FFFFh).

Status
A bit mapped status field indicating the current status of the block.

Bit

Definition

2-0

BootRecordPtrStatus

Indicates whether this block contains the boot record.
111 Block doesn't contain boot record.
110 Block contains current boot record.
000 Superseded boot record. Block contained the boot record but it was

superseded and moved to another block. The pointer is to be

considered FNULL.

9-3

Reserved
Must be all 1's.

15-10

State

Indicates the current state of the block.

State Value

Description

110000b

Block is ready. It contains a valid header structure.

0yyyyyb1

Block is queued for erasure. Any one of these values indicates this state. The high order bit of zero in the state value generally indicates a "queued for erasure" state.

111111b

Block is newly erased. The block does not contain ANY information and is all ones when in this state.

111110b

Block is in the process of having its erase count updated. A block that is newly erased must have its erase count updated before it can be used.

111100b

Block is a spare block. A spare block has only the erase count and its status field updated. The block is ready for use by the reclamation process when it's in this state.

111000b

Block is undergoing the reclamation process. A block in this state is having data from another block copied into it.

000000b

Block is retired. The block should NOT be used by the file system.

??????b

Block is in an undefined state if the state variable has any other value. It will be queued for erasure if it has an undefined value.


1. yyyyy represents any non-zero value.

BootRecordPtrStatus
Is used to indicate whether this block contains the boot record pointer for this partition. The file system, during initialization or a media change, reads a part of the block allocation structure of each block. The boot record pointer is read from the block containing it and partition information such as total block count, spare block count, block size, root directory location, and name convention, are obtained from the block pointed to.

In order to search for the boot record pointer, the file system must know the block size and the total number of blocks in the partition. Therefore the file system must obtain the block size and total number of blocks in the partition before it can locate the boot record.

Searching for the boot record is not anticipated to be a performance problem due to the low total number of blocks in the media, and the low read access times for the media.

State
A set of bit flags that are used by the file system to indicate the current state of this block.