國嵌參考內(nèi)核知識文件系統(tǒng)fs-htang_第1頁
國嵌參考內(nèi)核知識文件系統(tǒng)fs-htang_第2頁
國嵌參考內(nèi)核知識文件系統(tǒng)fs-htang_第3頁
國嵌參考內(nèi)核知識文件系統(tǒng)fs-htang_第4頁
國嵌參考內(nèi)核知識文件系統(tǒng)fs-htang_第5頁
已閱讀5頁,還剩46頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

靜UNIX系統(tǒng)V文件系Ext2文件動VFS文件靜?文件系統(tǒng)操作—mountrootUNIX系統(tǒng)V文件UNIX系統(tǒng)V文件 文件。當/public為NFS時:dcos3:~dcos3:~#ln-d/public/ln:creatinghardlink`/tmp/pub'to`/public/':Invalidcross-devicelinkUNIX系統(tǒng)V文件 nblocks

保存了本組所有的inode。應node描述文件與 件的存取 修改時間、文件類Block將連續(xù)的block分組。為什么盡量將屬于一個文件的block存放于一組內(nèi),保證 局部性多少個block兩個決定因素:&blockblockbitmapblockXgroupblock大小2XSuperBlock記錄superblockstructext2_super_block每一個block有多大我有多少Inode?多少block?他們中多少 的多少個block被保留每個blockgroup中,有多少個block?多少個我何時mount?mount了幾次?最多可以mount幾次上一次write操作在何時?上一次check操作在何時}GroupDiscriptorstruct{

bg_block_bitmap;/*Blocksbitmapblock*/bg_inode_bitmap;/*Inodesbitmapblock*/bg_inode_table;/*Inodestableblock*/bg__blocks_count;/*blockscount*/bg__inodes_count;/*inodescount }

/*DirectoriescountInode基本“構件”structext2_inode

文件模式表示文件類型atimectime文件模式表示文件類型atime--文件數(shù)據(jù)的最

AccessControlN ile /*N ile }i_mode01Regular23Character4Block5Named67SymbolicEXT2目 i_block[EXT2_N_BLOCKS];/*Pointerstoblocks#defineEXT2_IND_BLOCK#defineEXT2_DIND_BLOCK#defineEXT2_TIND_BLOCK#defineEXT2_N_BLOCKS

EXT2_NDIR_BLOCKS//12(EXT2_IND_BLOCK+1)//13(EXT2_DIND_BLOCK+1)//14(EXT2_TIND_BLOCK+1)//15度大于60時,將占用一個block來。60 u32 4 i_block15X460Named?VFS文件系

VFSVFSI/O設備動MMVFS↓VFS文件系進程的虛進程的虛擬內(nèi)塊設備緩沖VFS文件系 管理緩沖區(qū)(buffer.響應系統(tǒng)調(diào)用fcntl()和 (fcntl.c&映射名字到索引節(jié)點(namei.c,實現(xiàn)select(函數(shù)(select VFS文件系主要三個進程打

inodeFordisk-basedfilesystems,thisobjectusuallycorrespondstoa

,thisfilecontrolblockstoredon dentry FAT(FileAllocationTable):

VFSstructVFSstruct}}Objectsuper_blockstructsuper_blockstructsuper_blockstructsuper_blockstructsuper_operations}structsuper_operationsvoid(*read_inode)(structinode*);void(*write_inode)(structinode*,int);void(*delete_inode)(structinode*);}為保證文件系統(tǒng)性能,設備的superblock必須駐留內(nèi)存,整個VFS的superblocksuperblock記錄文件系統(tǒng)的具有共性的信息(如:文件同時,擁有著作用于這些信structsuper_block{structlist_heads_list;structfile_system_type structsuper_block{structlist_heads_list;structfile_system_type unsignedchar structsuper_operations*s_op;structdentry union{….}u;}super_blocksuperblock部分數(shù)據(jù)成員連接多個superblock的雙向文件系統(tǒng)類已修改(臟)的標掛載的dentryobjectsuperblock數(shù)據(jù)成員 superblock數(shù)據(jù)成super_blockstructsuper_blocksuper_blockstruct

structmsdos_sb_info}}superblock函數(shù)成員super_blockstructsuper_blockstructsuper_operationsread_inode(inode)dirty_inode(inode)}從磁 信息填寫inode(內(nèi)存當dirty標志被置位時執(zhí)行刪除inode(磁盤操作同put_inode,同時釋放內(nèi)inodeObjectinodestructinodestructinode_operations}structinodestructinodestructinode_operations}structinode_operations{int(*create)int(*link)int(*mkdir)}VFS的inode對數(shù)據(jù)與操作的實現(xiàn)與superblock相inodestructinodestructntfs_inode_info

struct}}inode函數(shù)成員inodestructinode_operations{create(dir,dentry,mode)lookup(dir,dentry)link(old_dentry,dir,new_dentry)unlink(dir,dentry)symlink(dir,dentry,symname)mkdir(dir,dentry,mode)rename(old_dir,old_dentry,}VFS文件filestructfilefilestructfilestruct }structfile_operations{loff_t(*llseek)ssize_t(*read)ssize_t(*write)}fileObject描述了進fileObject在進程打file數(shù)據(jù)成員

filestructunsignedintfilestructunsignedintf_flags; }filestructfile_operations{llseek(file,offset,origin)read(file,buf,count,offset)filestructfile_operations{llseek(file,offset,origin)read(file,buf,count,offset)write(file,buf,count,offset)readdir(dir,dirent,filldir)poll(file,poll_table)open(inode,file) }

VFS文件dentryObjectdentrystructdentrystructdentry*d_parent;structlist_headd_hash;structlist_headd_lru;structlist_headd_child;structlist_headd_subdirs;}structdentry_operationsdentrystructdentrystructdentry*d_parent;structlist_headd_hash;structlist_headd_lru;structlist_headd_child;structlist_headd_subdirs;}structdentry_operations}一級創(chuàng)建一個dentry/tmptest三個VFS文件structdentry_operationsstructdentry_operations}structdentry{atomic_td_count;structinode*}dentry與文件名對應的VFS文件沒有可用//由調(diào)度程序掌0隨時可能被回In內(nèi)核正在不會被回//VFS文件dentry& structfiles_struct{structfile**structfiles_struct{structfile**fd;}structtask_struct/*openfileinformationstructtask_struct/*openfileinformation*/structfiles_struct*files;}parentprocesschildprocesschildprocessotherprocesscount0countf_inodef_count=1f_inodef_count=20counti_count=2VFS文件系 mountrootmountroot一個空 ,將作為最初的掛載內(nèi)核將真正的root掛載到此 start_kernel(setup_32(start_kernel(setup_32(setup(第一階段-setup(rest_init(rest_init(第一階段-

分配superblockblock

start_kernel(setup_32(start_kernel(setup_3

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論