
1 7 Computer Core Practice1: Operating System Week15. Ext4 filesystem Jhuyeong Jhin and Injung Hwang Embedded Software Lab. Embedded Software Lab. 2 Ext2 filesystem 7 Features • FS partitions disk blocks into groups – Lower disk seek time • FS pre-allocates disk data blocks to regular files – Reducing file fragmentation • Fast symbolic links are supported – < 60 characters : stored in the inode Embedded Software Lab. 3 Directory 7 • struct ext2_dir_entry_2 4*n bytes Embedded Software Lab. 4 Memory Data Structure 7 • Most information are copied into RAM when the filesystem is mounted • The kernel uses the page cache to keep them up-to-date • In dynamic mode, the data is kept in a cache as long as the associated object is in use Embedded Software Lab. 5 Data Blocks Addressing 7 Embedded Software Lab. 6 The Ext 3 Filesystem 7 • Two simple concepts considered when designed – To be a journaling filesystem – To be, as much as possible, compatible with the old Ext2 • Journaling Filesystem – To guarantee the consistency of filesystem – When dynamic memory is lost, specific program executes an exhaustive, time-consuming check and fixes all the filesystem’s data structures on disk Embedded Software Lab. 7 The Ext3 Journaling Filesystem 7 • A copy of the blocks to be written is stored in the journal, then the blocks are written in the FS • Two cases – System failure before a commit to journal – System failure after a commit to journal • Ext3 provides 3 different mode – Journal – Ordered – Writeback Embedded Software Lab. 8 The Journaling Block Device Layer 7 • Ext3 Journal is usually stored in root directory : .journal • JBD (Journaling Block Device) handles the journal • Log record – Represented inside the journal as normal blocks of data • Atomic Operation Handle – journal_start(), journal_stop() • Transaction – Groups the log records that belong to several atomic operation handles into a single transaction Transaction Block Block Block Block Block Block Block Block File Operation Log Record Embedded Software Lab. 9 The Ext4 Filesystem 7 • Definition – The Ext 4 is a journaling file system for Linux, developed as the successor to Ext 3 • History – The early version was included in linux kernel 2.6.19 • Features – Large file system, Extents – Backward compatibility – Persistent pre-allocation – Delayed allocation – Increasing the 32,000 subdirectory limit – Journal check summing – Faster file system checking – Multi-block allocator – Improved timestamps – Transparent encryption Embedded Software Lab. 10 Ext3 vs. Ext4 7 Embedded Software Lab. 11 Extent 7 • A single descriptor for a range of contiguous physical blocks – A efficient way to represent large file – Better CPU utilization, fewer metadata IOs • Similar to “cluster” runs in the NTFS file system • struct ext4_extent Embedded Software Lab. 12 Indirect Mapping vs. Extent 7 Embedded Software Lab. 13 Delayed Allocation 7 • Delayed allocation is used by write system call – It delays real block allocation until written data is flushed from memory to disk • Prevent file fragmentation and decreases CPU utilization • Suppress writes to temporary files which exist for short period • Tradeoff between performance and reliability Embedded Software Lab. 14 Practice #9 7 • Print the followings – The block size of the filesystem to which the file “prac_file.txt” belong – The size of the file – The file name, modified time and # of blocks of the file • Get the open file structure, inode and super block – The file mapped in the address space of current process – Reference: mm_struct, vm_area_struct, inode, super block – Inode and super block are defined in include/linux/fs.h Embedded Software Lab..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages14 Page
-
File Size-