1 / 47

Linux Filesystems

Linux Filesystems. 9662815 林承諺 9662822 關啟邦. Linux Filesystems: The Virtual Filesystem. Outline. VFS Filesystem Types Common File Model Structure of VFS Mount Path lookup open read. VFS- Virtual Files System. To Support various native filesystems

Download Presentation

Linux Filesystems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linux Filesystems 9662815 林承諺 9662822 關啟邦

  2. Linux Filesystems: The Virtual Filesystem

  3. Outline • VFS • Filesystem Types • Common File Model • Structure of VFS • Mount • Path lookup • open • read

  4. VFS- Virtual Files System • To Support various native filesystems • To allow access to files of other operating systems • Provide uniform ways of manipulating files, directories, and other objects • The kernel supports more than 40 filesystems.

  5. VFS

  6. VFS $cp /floppy/TEST /tmp/test Understanding the Linux Kernel 3rd Ed

  7. Filesystem Types • Disk-based filesystems • Storing files on nonvolatile media • Ext2/3, Reiserfs, FAT, and ISO9660 • Make use of block-oriented media • Network filesystems • Permit access to data on a computer attached to the local computer via a network

  8. Filesystem Types • All operations on files in this filesystem are carried out over a network connection • NFS, Coda, AFS, NCP(Novell) • Virtual filesystems (Special filesystems) • Generated in the kernel itself • Requires no storage space on any kind of hardware device • A simple interface to access the contents of some kernel data structure • /proc

  9. The Common File Model • Supports a uniform view of the objects in the filesystem. • A structure model consisting of all components that mirror a powerful filesystem • The model exists only virtually and must be adapted to each filesystem using a variety of objects with function pointers

  10. The Common File Model • Inode Object • Information about a specific file • Inode number • Store in filesystem control block • File Object • Interaction between an open file and a process • Only in kernel memory

  11. The Common File Model • Superblock Object • Information concerning a mounted filesystem • Store in filesystem control block • Dentry Object • Directory entry cache • Provide quick access to the results of a previous full lookup operation • Establish a link between a filename and its inode

  12. Inode Object linux/include/linux/fs.h Device file

  13. Inode lists • Each inode has a i_list to store the inode on a list • State of inode • inode_unused • Valid but no longer active inodes • inode_in_use • Used but unchanged inodes • i_count >0, i_nlink >0 • Dirty inodes • invalidate_inodes fs/inode.c

  14. Inode Operations linux/include/linux/fs.h

  15. File Objects linux/include/linux/fs.h

  16. File Operations linux/include/linux/fs.h

  17. Superblock Object linux/include/linux/fs.h

  18. Superblock operations linux/include/linux/fs.h

  19. Dentry Object linux/include/linux/dcache.h

  20. Dentry Operations linux/include/linux/dcache.h

  21. Interplay of VFS components

  22. Registering Filesystems linux/fs/filesystem.c

  23. Registering Filesystems linux/include/linux/fs.h

  24. Mount

  25. sys_mount linux/fs/namespace.c

  26. do_mount linux/fs/namespace.c

  27. do_new_mount

  28. do_new_mount linux/fs/namespace.c

  29. do_kern_mount linux/fs/super.c

  30. vfs_kern_mount linux/fs/super.c

  31. Mount rootfs

  32. mount_root linux/init/do_mounts.c

  33. mount_block_root linux/init/do_mounts.c

  34. do_mount_root linux/init/do_mounts.c

  35. Path lookup

  36. __link_path_walk linux/fs/namei.c

  37. __link_path_walk linux/fs/namei.c

  38. __link_path_walk linux/fs/namei.c

  39. do_lookup linux/fs/namei.c

  40. follow_link linux/fs/hostfs/hostfs_kern.c

  41. Opening Files

  42. sys_open linux/fs/open.c

  43. do_sys_open linux/fs/open.c

  44. Reading Files

  45. sys_read linux/fs/read_write.c

  46. vfs_read linux/fs/read_write.c

  47. Reference • Linux-2.6.29 • Professional Linux Kernel Architecture • Understanding the Linux Kernel • IBM developWorks kernel anatomy series

More Related