Major Progress on Re-xv6 Project Until 6th July 2019

File System

During this week, many changes have been applied to the file system of the original xv6, allowing partitions and mounting. So far, a skel of mount syscall and a support for MBR (Master boot record) has been introduced, which makes it possible to have at most 4 partitions, or “primary partitions” on a single disk.
File system with partitions

Combination of two separated disk image

Original xv6 uses xv6.img alone with fs.img. The fomer one contains bootloader and the kernel itself while the latter one provides the whole file system. It makes things simple for the learners. However, when it comes to practicality, things went different. For example, two separated part of disk image makes it hard to be applied to a physical machine. With the convenience of mbr needed by the partitions, we can easily combine the two into one.
The difficulty is that MBR allows only 446 bytes for bootloader while the original bootloader is a little larger. The code of bootloader not being able to be trimmed, -Os optimization has been applied to bootblock, making it narrowly fit the size.

Partitions

By introducing MBR, we can easily obtain the support for disk partition. Although this technique is not so important as many sophiscated vendor such as Microsoft not longer recommend partitions, it still play a role in many other aspects.
The most changes were applied to fs.c and mkfs.c, including a re-structure for mkfs tool, making it possible to be refactored in the following weeks.

Mount Syscall

A simple mapping scheme was adopted. This part is only functionally accomplished. For it introduce too much not-well-designed code, it will be thoroughly reimplement in the near future.

Problems

  1. The implementation is not elegant enough.
  2. The mount implementation works weirdly.
  3. VFS has not been introduced.
    The problems are what to be worked out recently.

Acknowledgements

asafch/xv6-fs
OS162 Assignment 4