xiaochen
xiaochen

Reputation: 1305

Why do we need directory structure for file system?

Jos of MIT OS lesson only uses File structure to describe regular file or dir. But linux kernel uses dentry/inode/file structure to describe files. Is it neccessary to use dentry for file system?

Upvotes: 0

Views: 1162

Answers (2)

flyrain
flyrain

Reputation: 583

In Linux, dentry is a directory entry that associates inode and file object, but it is not necessary just a directory, could represent a file. Dentry enables the hard link which allows allow multiple hard links to be created for the same file. So you can create multiple names for the same file.

Dentry cache also does matter for performance of File system. The following picture is from "Understanding the Linux Kernel, 3rd Edition" which shows interactions between processes and VFS objects.

enter image description here

Upvotes: 1

marinara
marinara

Reputation: 538

Jos does use directory entries. It just uses the File object to store directories (they use teh same object for storing directory data and file data)

Upvotes: 0

Related Questions