Expand description
§Fast File System (FFS).
In KeOS, the kernel utilizes multiple layers to implement file operations. Higher layers provide convenient abstractions such as buffered I/O, while the lowest layer is responsible for managing the on-disk layout through the File System.
┌─────────────────────────────┐
│ keos::fs::RegularFile │
│ - Top-level API for File │
└─────────────┬───────────────┘
│
┌─────────────▼───────────────────┐
│ keos::fs::traits::RegularFile │
│ - Block-based buffer │
│ - Block-level R/W interface │
└─────────────┬───────────────────┘
│
┌─────────────▼─────────────────────────┐
│ pagecache::overlaying::RegularFile │
│ - Cache-managed file access │
└─────────────┬─────────────────────────┘
│
┌─────────────▼─────────────────────────┐
│ Filesystem-specific RegularFile │
│ - Primitive block ops on filesystem │
└─────────────┬─────────────────────────┘
│
┌─────────────▼─────────────────────────┐
│ Inode │
│ - Conduct the disk-level operation │
└───────────────────────────────────────┘This project focuses on implementing the File System, the lowest level in the hierarchy. Here, you will build the abstractions that directly manage on-disk inodes and blocks, forming the foundation of all higher-level file operations.
A file system is a fundamental component of any operating system, responsible for managing how data is stored, organized, and accessed on persistent storage devices such as hard drives or solid-state drives. It provides a hierarchical abstraction of files and directories, enabling users and programs to interact with stored data through well-defined interfaces while abstracting away low-level hardware details. The file system ensures data integrity, persistence, and consistency, even in the face of system crashes or concurrent access.
While simple file systems may achieve functional correctness, they often suffer from performance limitations, such as poor spatial locality, excessive fragmentation, and inefficient handling of metadata. These issues become increasingly problematic as file systems scale in size and complexity.
The Fast File System (FFS) was developed to address these shortcomings. It incorporates layout and allocation strategies aimed at improving throughput, minimizing seek time, and optimizing disk utilization. Key features include.
In this project, you will implement the simplified version of Fast File System: No error handling and I/O optimizations.
§Overview of the KeOS Fast File System
The following diagram depicts the disk layout of the FFS:
+────────────────────+
│ Superblock │
+────────────────────+
│ Inode Bitmap │
+────────────────────+
│ Block Bitmap │
Journal ──-+────────────────────+
│ │ JournalSB │
│ +────────────────────+
│ │ TxBegin │
│ │ Journal Block[0] │
│ │ Journal Block[1] │
│ │ ... │
│ │ TxEnd │
└─────── +────────────────────+
│ Inodes │
+────────────────────+
│ Data Blocks │
│ ... │
+────────────────────+The following list describes each parts of the FFS disk layout:
- Superblock – Global filesystem metadata: block size, counts, offsets, and identifiers.
- Inode Bitmap – Tracks which inodes are allocated or free.
- Block Bitmap – Tracks which data blocks are allocated or free.
- Journal – Transactional log ensuring crash consistency.
- Inodes – The inode table storing metadata and block pointers for files and directories.
- Data Blocks – The actual contents of files and directories.
Now, start with the implementation of inode.
Modules§
- access_
control - Metadata access and synchronization primitives for the filesystem.
- disk_
layout - on-disk layout of the file system’s metadata structures.
- fs_
objects - File system objects.
- inode
- Inode abstraction.
- journal
- Journaling for Crash Consistency.
- types
- Core type definitions for the filesystem.
Structs§
- Fast
File System - A reference-counted wrapper around
FastFileSystemInner. - Fast
File System Inner - Represents the internal structure of a Fast File System (FFS).
- JournalIO
- A handle for performing journal I/O operations.