ext2文件系統的核心數據結構是怎樣的,相信很多沒有經驗的人對此束手無策,為此本文總結了問題出現的原因和解決方法,通過這篇文章希望你能解決這個問題。
主要定義在ext2.h
頭文件中。
名稱 | 意義 |
---|---|
struct ext2_inode | 磁盤上inode的布局,用來讀出和寫入inode??梢愿鶕薸node生成VFS對應的標準inode。 |
struct ext2_super_block | 對應磁盤上實際的ext2的超級塊,可以轉換為VFS的標準超級塊,同上用來表示ext2的特有信息。一個文件系統只有一個,可以有多個備份。 |
struct struct ext2_sb_info | 同樣是用來擴展超級塊的。 |
struct ext2_dir_entry /struct ext2_dir_entry_2 | 目錄項。_2 后綴的表示是新版本的,兩者通過對name_len后未使用的8bit實現兼容。 |
struct ext2_inode_info | 擴展的inode。ext2_inode中的某些信息VFS中標準的inode不能存放,但其提供了擴展手段。ext2_node_info就是用來擴展保存這些額外信息的。 |
struct ext2_reserve_window | 塊分配實現中關于預留窗口的信息。 |
struct ext2_reserve_window_node | 預留窗口的紅黑樹節點。 |
struct ext2_block_alloc_info | 塊分配信息。 |
為什么要有兩種類型,內存的和磁盤的?
磁盤上數據之間的相互索引基準為block id,即塊id。而在程序運行時,計算機中的信息都是保存在內存中,相互引用的基準是內存地址。在信息保存和讀取時,做要一次轉換,所以有兩種類型。一種對應磁盤中的信息,在讀寫時用到;另外一種是內存中的信息,在處理信息時用到。
方法類是按照VFS要求定義一些方法集合,可以理解為鉤子函數。
名稱 | 意義 |
---|---|
struct file_operations ext2_dir_operations | ext2中對目錄的操作方法集合。 |
struct inode_operations ext2_file_inode_operations | 文件inode的操作方法集合,修改文件的屬性, |
struct file_operations ext2_file_operations | 文件操作方法集合。 |
struct iomap_ops ext2_iomap_ops | iomap處理方法集合,進行內存映射。 |
struct address_space_operations ext2_aops | 地址空間處理,還有個nobh的版本。 |
struct inode_operations ext2_dir_inode_operations | 目錄inode操作方法集合。 |
struct inode_operations ext2_special_inode_operations | 特殊類型inode的操作方法集合。 |
struct inode_operations ext2_symlink_inode_operations | 鏈接類型inode的操作方法集合。 |
struct super_operations ext2_sops | 超級塊的操作方法集合。 |
struct file_system_type ext2_fs_type | 文件系統類型的注冊結構。 |
看完上述內容,你們掌握ext2文件系統的核心數據結構是怎樣的的方法了嗎?如果還想學到更多技能或想了解更多相關內容,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。