From OSLab

Labs: HW4

File Systems

Assigned: 11/3/06 Due: 11/17/06

Objective

The goal of this lab is to write a simple UNIX-like file system. The file system you will write make the following simplifying assumptions:

The layout of your 128 KB disk is as follows

Note that each inode is 48 bytes in size; Since you have 16 of these, the total space occupied by the inodes is 768 bytes. The free/used block information (mentioned above) is 128 byes, for a total of 896 bytes used in the 1024-byte superblock. The remaining bytes are unused.

Superblock diagram

Documentation and Resources:

Implementation

Note that there is no need for a mkfs program, as a superblock of all zeros corresponds to an empty filesystem. (i.e. all blocks free, all inodes free)

You will need to implement the following:

  • module_init - invoke register_filesystem
  • fill_super method - read the superblock, invoked at mount time
  • struct super_operations, containing the methods alloc_inode, destroy_inode, read_inode, write_inode, delete_inode, put_super, write_super, statfs.
  • struct inode_operations for directory inodes, with methods create, lookup, link, unlink, rename. (note that file inodes are assigned a struct inode_operations as well, but it can be completely empty)
  • struct file_operations for directory inodes, with methods read, readdir, and fsync
  • struct file_operations for file inodes, with methods llseek, read, write, mmap, and sendfile. (these should point to the corresponding generic_* operations)
  • struct address_space_operations, containing readpage, writepage, sync_page, prepare_write, commit_write, bmap.

Testing

Submission

Please submit via email the source code for the filesystem module, a test log (e.g. use script to capture the terminal session while testing manually, or put the commands in a script file and run it with sh -x), and a short (1 page is OK) writeup of your design.

Retrieved from http://www.oslab.info/index.php/Labs/HW4
Page last modified on November 03, 2006, at 12:14 PM EST