Linux Virtual Filesystem презентация

Слайд 2

Linux VFS Layer

Kernel-wide filesystem view
Superblock (struct super_block) describes a filesystem, provides operations the

OS can use
Each superblock has a list (in its s_list field) of superblocks for all available file systems
It also keeps lists of index nodes, directory entries, files
Process-specific filesystem view
Process’ task_struct points to 3 filesystem structs
Field fs points to a filesystem structure (struct fs_struct)
Field files points to open files table (struct files_struct)
Field nsproxy points to a wrapper for its namespace, etc.
Each of these has further structure we will look at next

CSE 422S – Operating Systems Organization

Слайд 3

Linux Process’ Views of Filesystem

CSE 422S – Operating Systems Organization

files_struct

task_struct

nsproxy
Fields in the process’

task_struct point to key filesystem structs
The new nsproxy field points to a nsproxy struct that wraps a pointer to the filesystem’s namespace (mnt_namespace)
The files field points to a table of process’ open files
The fs field points to a filesystem structure that points to paths for the process’ root and current working directories

fs_struct

nsproxy

mnt_namespace

current

fs

files

root

pwd

Слайд 4

Paths and Directory Entries

CSE 422S – Operating Systems Organization

task_struct
Each path points to a

VFS mount structure (vfs_mount) and a directory entry (dentry) structure (filesystem+directory)
A VFS mount structure describes a specific filesystem instance (a “mount point”)
A directory entry structure describes any element in the filesystem (directory or file, though in a path it’s a directory)

fs_struct

current

fs

root

pwd

path

dentry

mnt

dentry

Vfs_mount

Слайд 5

Directory Entries and Index Nodes

CSE 422S – Operating Systems Organization
Each directory entry points

to an associated index node (inode) that contains metadata about the directory entry
Last access time, permissions, etc.
E.g., what you see with ls command
Index nodes also implement operations the superblock uses
Each directory entry also has a character array field (d_iname) that contains its name

inode

d_inode

dentry

d_iname

‘/’

\0

...

Слайд 6

Directory Entry Hierarchy

CSE 422S – Operating Systems Organization
A directory’s dentry lists other directory

entries that it contains
Stored in its d_subdirs field
List iteration requires special operations (see LKD Chapter 6)
E.g., list_empty(), list_for_each(), list_for_each_entry(), etc.
Can use those operations to traverse a path (or an entire filesystem) recursively via the directory entry hierarchy

dentry

d_iname

‘/’

\0

...

d_subdirs

...

dentry

d_iname

‘b’

‘i’

...

d_subdirs

...

‘n’

\0

...

dentry

d_iname

‘l’

‘s’

...

d_subdirs (empty)

\0

Имя файла: Linux-Virtual-Filesystem.pptx
Количество просмотров: 69
Количество скачиваний: 0