LinuxEXT4文件系统分析

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

ComputerKnowledgeandTechnology:714(20115)LinuxEXT4(,310016):EXT4,EXT3,WRITEEXT4,Linux。:EXT4;;;i:TP391:A:1009-3044(2011)14-3443-04TheAnalysisofLinuxEXT4FileSystemLUYa-wen(HangzhouVocationalCollegeofScienceandTechnology,Hangzhou310016,China)Abstract:ComparedwithEXT3filesystem,thetheoryanddatastructureofEXT4filesystemwasintroduced.ByanalyzingtheWRITEoperation,theprocedcureofEXT4filesystemwasexplained,andthestudywillsupplysomereferencesforuserswhochoosingcoreofLinux.Keywords:EXT4;dailyrecord;handle;inodeEXT4,100%EXT3,EXT3。,,,、,。EXT4(jbd)[1],,,NVRAM,EXT4。,EXT4e2fsck,,EXT4EXT3[2]。,EXT4,EXT4,EXT4。1EXT42.6.28。1.1super_block/include/linux/EXT4_fs.hstructEXT4_super_block{/*00*/__le32s_inodes_count;/**/__le32s_blocks_count;/**/__le32s_r_blocks_count;/**/__le32s_free_blocks_count;/**//*10*/__le32s_free_inodes_count;/**/__le32s_first_data_block;/**/__le32s_log_block_size;/**/__le32s_log_frag_size;/**//*20*/__le32s_blocks_per_group;/**/__le32s_frags_per_group;/**/__le32s_inodes_per_group;/*#*/__le32s_mtime;/**/…………/*150*/__le32s_blocks_count_hi;/*32*/__le32s_r_blocks_count_hi;/*32*/__le32s_free_blocks_count_hi;}/*32*/,,。EXT4,e2fsck,,,。:2011-03-25:2009(20071302):(1978-),,,,,。E-mail:kfyj@cccc.net.cn,34723443ComputerKnowledgeandTechnology:714(20115),EXT4,EXT3,EXT4。1.2GroupDescriptor,。inode,。,,。structEXT4_group_desc{__le32bg_block_bitmap;/**/__le32bg_inode_bitmap;/**/__le32bg_inode_table;/**/__le16bg_free_blocks_count;/**/__le16bg_free_inodes_count;/**/__le16bg_used_dirs_count;/**/__u16bg_flag;/*32*/__u32bg_reserved[3];__le32bg_block_bitmap_hi;/*32*/__le32bg_inode_bitmap_hi;/*32*/__le32bg_inode_table_hi;};/*32*/1.3istructEXT4_inode{__le16i_mode;/*,*/__le16i_uid;/*id16*/__le32i_size;/**/__le32i_atime;/**/__le32i_ctime;/**/__le32i_mtime;/**/__le32i_dtime;/**/__le16i_gid;/*16*/__le16i_links_count;/**/__le32i_blocks;/*I*/__le32i_flags;/**/union{struct{__le32l_i_reserved1;}linux1;struct{__le32h_i_translator;}hurd1;struct{__le32m_i_reserved1;}masix1;}osd1;/*OSdependent1*/__le32i_block[EXT4_N_BLOCKS];/*,15*/__le32i_generation;/*(forNFS)*/__le32i_file_acl;/*ACL*/__le32i_dir_acl;/*ACL*/__le32i_faddr;/**/union{struct{__le8l_i_frag;/**/__le8l_i_fsize;/**/__le16i_pad1;__le16l_i_uid_high;/*Iid*/__le16l_i_gid_high;/*I*/__le32l_i_reserved2;}linux2;//1struct{__le8h_i_frag;/**/__le8h_i_fsize;/**/3444ComputerKnowledgeandTechnology:714(20115)__le16h_i_mode_high;__le16h_i_uid_high;__le16h_i_gid_high;__le32h_i_author;}hurd2;//struct{__le8m_i_frag;/**/__le8m_i_fsize;/**/__le16m_pad1;__le32m_i_reserved2[2];}masix2;//2}osd2;/*OSdependent2*/__le16i_EXTra_isize;__le16i_pad1;__le32i_ctime_EXTra;/*(nsec2|epoch)*/__le32i_mtime_EXTra;/*(nsec2|epoch)*/__le32i_atime_EXTra;/*(nsec2|epoch)*/__le32i_crtime;/**/__le32i_crtime_EXTra;};/*(nsec2|epoch)*/,,i12,13,14,15,,,。EXT3,EXT4,5,,。1.4i,[3]。2.62.4。i。,。i,。i。,EXT4_truncate,0,。。[4]。,。。structEXT4_inode_info{__le32i_data[15];__le32i_flags;//i#ifdefEXT4_FRAGMENTS__le32i_faddr;//__le8i_frag_no;//__le8i_frag_size;//#endif__le32i_file_acl;__le32i_dir_acl;__le32i_dtime;__le32i_block_group;//i__le32i_state;/*EXT3*/__le32i_nEXT_alloc_block;/*i_nEXT_alloc_block。,,。/*__le32i_nEXT_alloc_goal;/*i_nEXT_alloc_goal。。*/structsemaphoretruncate_sem;//,structinodevfs_inode;/*,EXT4linux*/};1.5handle_tEXT4。structhandle_s3445ComputerKnowledgeandTechnology:714(20115){transaction_t*h_transaction;//inth_buffer_credits;//inth_ref;//inth_err;//structlist_headh_jcb;//unsignedinth_sync:1;/*sync-on-close*/unsignedinth_jdata:1;/**/unsignedinth_aborted:1;/**/};transaction_t。。:*RUNNING:*LOCKED:*RUNDOWN:。*FLUSH:。*COMMIT:,*FINISHED:2EXT42.1EXTstructfile_operationsEXT3_file_operations={.llseek=generic_file_llseek,.read=do_sync_read,.write=do_sync_write,.aio_read=generic_file_aio_read,.aio_write=EXT3_file_write,.readv=generic_file_readv,.writev=generic_file_writev,.ioctl=EXT3_ioctl,.mmap=generic_file_mmap,.open=EXT3_open_file,.release=EXT3_release_file,.fsync=EXT3_sync_file,.sendfile=generic_file_sendfile,};EXT4readdo_sync_read,writedo_sync_write,。EXT4。2.2EXT4,:1。①file-f_op-writeEXT4write,opera-tionwritedo_sync_write。②filp-f_op-aio_writeEXT4aio_write,operationaio_writeEXT4_file_write。LINUXsys_write,sys_writefile,vfs_write,file-f_op-write,EXT3write(do_sync_write)aio_write(EXT4_file_write)。EXT4_file_write2。3LinuxEXT4,EXT4(3472)123446ComputerKnowledgeandTechnology:714(20115)(3446),。,。2.6.28EXT42.4,,Htree(),NTFS。EXT4。:[1],.LINUX[M].:,2002.[2],.Linux2.6()EXT3[J].,2004(6):8-10.[3].Ext—[J].,2010(8):133-136.[4],.Linux[M].:,2006.,,,,。,,。,GPS、IMU/GPS、、;GPSIMU/GPS。,,,,。3.3,,。、、,,,,。,(DLG)(、、DVD-ROM),、、,。(DOM)(DEM),、。,,。4,,,,。,。,,。,,。:[1],,.[M].:,2004.[2].、[J].,1999(2).3472

1 / 5
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功