Virtual file system (VFS)

634 views
351 views

Published on

Published in: Engineering, Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
634
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
9
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Virtual file system (VFS)

  1. 1. 1 Virtual FileSystem(VFS) Wayling 2011.12.20
  2. 2. 2 Outline • Introduce VFS • VFS implement • Ramfs • Vfs/ramfs to Bos
  3. 3. 3 virtual file system(1/2) ls mkdir mount libc VFS cpiofs procfs arfs devfs tarfs ramfs filesystem
  4. 4. 4 virtual file system(2/2) • vfs framework – vnode / file / dirent struct – mount / mkdir • no file I/O – device model – file block struct – read / write • no lock – no Synchronized
  5. 5. 5 VFS implement (call trace) • mount->sys_mount->ramfs_mount • mkdir->sys_mkdir->ramfs_mkdir • open_dir->sys_opendir->ramfs_opendir • read->sys_read->ramfs_read • write->sys_write->ramfs_write
  6. 6. 6 VFS implement (vnode)
  7. 7. 7 vfs 轉換 • 轉換vnode 到個別檔案系統的節點 – namei / lookup • 找到對應filesystem,root point • 分解路徑 • 轉換 /test/test1 / /test /test/test1 Filesystem 相關
  8. 8. 8 mount • “/” ,根目錄比較特別,需要直接用mount建立, 其他目錄皆需用mkdir創建 • sys_mount掛載一個檔案系統,所有操作皆會 被轉為此檔案系統各自的操作 / ramfs /test ext2
  9. 9. 9 mkdir • sys_mkdir建立vnode轉為個別檔案系統的節 點之操作 依據路徑 轉換vnode 是否存在 目錄存在 建vnode, 呼叫對應檔案系統之mkdir
  10. 10. 10 vnode 查詢 • vnode查詢頻繁,故使用hashfunction查詢 vnode_table
  11. 11. 11 ramfs(1/2) • vnode -> ramfs_node • ramfs 自我組織 / /test1 /test2 /test
  12. 12. 12 ramfs 填填看(2/2)
  13. 13. 13 vfs/ramfs to Bos • Porting from prex/xboot • Github https://github.com/benwei/bos/tree/feature- vfs • fs – vfs – ramfs • ls command
  14. 14. 14 reference • [vfs-feature] • https://github.com/benwei/bos/tree/feature- vfs • [xboot] • https://github.com/jerryjianjun/xboot • [prex] • https://github.com/AndrewD/prex

×