Agenda

<aside> ๐Ÿ“Œ Reminders

๐Ÿ‘๏ธ iNodes

When we interact with files on a filesystem, we typically refer to them by their filenames. However, behind the scenes, the operating system uses a more abstract identifier to manage files: the inode.

An inode is a data structure that contains metadata about a file, such as its size, permissions, ownership, and the pointers to the actual data blocks stored on the disk. The filename we see is just a human-readable alias for the inode, which is how the system actually tracks and accesses the file.

One key advantage of inodes is that they allow the system to quickly retrieve metadata without needing to read through the entire file. This can be particularly useful for operations like checking file permissions or determining file size. However, because inodes only store metadata and not the file content itself, they don't provide any information about the actual file's data beyond its location.

Some key data stored in an inode (this list is not exhaustive):

The pointers to data blocks are very important and can be implemented in various ways, this is discussed further belowโ€ฆ

๐Ÿ”ธIn pintOS

inodes in pintOS are defined in src/filesys/inode.c, you will need to modify the existing inode struct for this project

/* In-memory inode. */
struct inode 
  {
    struct list_elem elem;              /* Element in inode list. */
    block_sector_t sector;              /* Sector number of disk location. */
    int open_cnt;                       /* Number of openers. */
    bool removed;                       /* True if deleted, false otherwise. */
    int deny_write_cnt;                 /* 0: writes ok, >0: deny writes. */
    struct inode_disk data;             /* Inode content. */
  };