A log-structured filesystem is a filesystem that operates on a disk that is structured as a list of blocks. For my virtual disk that my filesystem will operate on I use 4096 blocks of 512 bytes. The first 10 blocks are reserved. Block 0 is the 'superblock' which stores the metadata of the disk. Block 1 is our 'free node block' which has 4096 bits each representing the availability of the corresponding block address. '1' means available, '0' means unavailable. The first 10 blocks are reserved for our superblock, free node block, and INode mapping. Blocks 2 to 9 contain the INode mapping. The INode mapping uses big-endian hex values that are equivalent to the integer value of an INode block address. An INode contains the metadata associated with a file or directory including its block addresses.
The primary functionality of the file system can be found in io/file.c. All of these functions interact with the disk.c file which is responsible for making changes to the vdisk file otherwise called the "virtual disk". The code in file.c contains the following functions.