Inodes, Directory Entries, and File Identity

Separate a file’s metadata object from its pathnames and follow the lifetime of an unlinked but still-open file.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Names map to objects through directory entries
  2. Removing a name need not release the data immediately

Names map to objects through directory entries

An inode-style filesystem can store file metadata and data block references in an object identified independently of its visible name. A directory entry binds one name to that identity. Creating a hard link adds another directory entry for the same object. A symbolic link instead stores a value used for a separate pathname resolution. Permissions and lifetime rules differ across operations and object types.

Removing a name need not release the data immediately

If a file has two hard links, removing one leaves the other naming the same object. When all names are removed, an existing open handle may still keep the object accessible under the filesystem contract. Reclaim after the relevant link and open-reference conditions are both met. Reference counting illustrates a related lifetime rule. Filesystem journaling keeps changes to names and their metadata consistent across crashes.[1]

References

  1. Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces ↩