Oceanstore is a distributed file system. Its design is motivated from OceanStore: An Architecture for Global-Scale Persistent Storage paper.
WIP
The two primitive file system objects are files and directories. A file is a single collection of sequential bytes and directories provide a way to hierarchically organize files.
- Data block represents fixed length array of bytes. Files consist of a number of data blocks.
- Indirect block stores references to ordered list of data blocks that make up a file.
- Inode maintains the metadata associated with a file. Inode of a file points to direct blocks or indirect blocks. Inode of a directory points to inode of files or other directories.
Find the inode of the root. Traverse the directories/files in its indirect block to find the first directory/file in the path. Repeat the search until we reach end of path.
To write or read from file, we need:
- Location This tells the starting location in the file for reading or writing.
- Buffer While reading, contents of the file are put in buffer and while writing, contents of the buffer are put into the file.
If we pass the end of the file while writing then we need to add new data blocks and add their refernces in the indirect block. We also choose the block size. Given the starting location and number of bytes to read or write, it is easy to find the relevant blocks with start position in the first block and end position in the last block.