Linux File systems The VFS - PowerPoint PPT Presentation

About This Presentation
Title:

Linux File systems The VFS

Description:

Find the VFS inode of the directory that is to be the new file system's mount point. ... The Directory Cache. Speed up accesses to commonly used directories. ... – PowerPoint PPT presentation

Number of Views:333
Avg rating:3.0/5.0
Slides: 18
Provided by: cseIit
Category:

less

Transcript and Presenter's Notes

Title: Linux File systems The VFS


1
Linux File systems The VFS
  • Advait Jain
  • Priyanka Jindal

2
What is the VFS ?
  • Component in the kernel that handles
    file-systems, directory and file access.
  • Abstracts common tasks of many file-systems.
  • Presents the user with a unified interface, via
    the file-related system calls (open, stat, chmod
    etc.).
  • Filesystem-specific operations- vector them to
    the filesystem in charge of the file.

3
(No Transcript)
4
Mounting a device
  • mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
  • Steps involved
  • Find the file system.(file_systems list)
  • Find the VFS inode of the directory that is to be
    the new file system's mount point.
  • Allocate a VFS superblock and call the file
    system specific read_super function.

5
List of all file systems
6
The currently mounted file systems
7
Opening a File
  • Pathname is used by the VFS to search through the
    directory (pathname to device number, block
    number).
  • Calls the lookup() method (file system specific)
    of the parent directory inode to look up the
    inode.
  • Caches the directory entries during this
    traversal. (DCache)

8
  • Check for permissions and if ok then proceed.
  • Allocates a file structure with a pointer to its
    dentry and to file specific operations.
  • File structure is placed into the file descriptor
    table for the process.
  • Read, write etc. will use this user-space file
    descriptor.

9
(No Transcript)
10
The Directory Cache
  • Speed up accesses to commonly used directories.
  • Hash table- device number and directory's name
    to calculate the hash value
  • Only short directory entries (up to 15 characters
    long) are cached. eg./usr/X11R6/bin
  • Dcache replacement policy- two level LRU cache
    list.

11
VFS Inode Cache
  • Is similar to Dcache in implementation.

12
Buffer Cache
  • The Linux file systems regard block devices as a
    linear collections of blocks irrespective of the
    underlying physical disk's geometry.
  • Device driver maps a particular block of its
    device into track, sector and cylinder etc.
  • As blocks are accessed, they are put into the
    Buffer Cache
  • Also helps manage the asynchronous interface with
    the block device drivers.

13
Buffer Cache
  • Shared between all of the physical block devices.
  • Block buffers within the cache are identfied by
    the device identifier and the block number.
  • 2 functional parts
  • lists of free block buffers (of different sizes)
  • the cache (hash table).
  • House-keeping of the buffer cache pdflush

14
VFS Inode
  • Device, inode number
  • unique within VFS.
  • owner uid
  • permission information
  • i_op
  • pointer to inode operations.
  • dirty
  • VFS inode has been written to (write back to the
    block device).

15
Implementing a filesystem
  • struct file_system_type
  • read_super
  • called when a new instance of this file system is
    mounted.
  • s_op pointer to a "struct super_operations"
    (next level of the filesystem implementation.)
  • struct super_operations
  • read_inode, write_inode, write_super ...
  • read_inode (struct inode )
  • fills the i_op member of the VFS inode
  • Methods that can be performed on individual
    inodes.

16
  • read_inode
  • also fills the i_fop field with the struct
    file_operations
  • struct inode_operations
  • lookup called when the VFS needs to look up an
    inode in a parent directory.
  • struct file_operations
  • read, write, readdir
  • open
  • before open is called VFS copies i_fop field of
    the inode to the f_op field of the newly
    allocated file structure.

17
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com