For the sake of efficiency, most information stored in the disk data structures of an Ext2 partition are copied into RAM when the filesystem is mounted, thus allowing the kernel to avoid many subsequent disk read operations. To get an idea of how often some data structures change, consider some fundamental operations:
When a new file is created, the values of the
s_free_inodes_count field in the Ext2 superblock
and of the
bg_free_inodes_count field in the
proper group descriptor must be decremented.
If the kernel appends some data to an existing file so that the
number of data blocks allocated for it increases, the values of the
s_free_blocks_count field in the Ext2 superblock
and of the
bg_free_blocks_count field in the group
descriptor must be modified.
Even just rewriting a portion of an existing file involves an update
s_wtime field of the Ext2 superblock.
Since all Ext2 disk data structures are stored in blocks of the Ext2 partition, the kernel uses the buffer cache and the page cache to keep them up to date (see Section 14.2.4).
Table 17-6 specifies, for each type of data related to Ext2 filesystems and files, the data structure used on the disk to represent its data, the data structure used by the kernel in memory, and a rule of thumb used to determine how much caching is used. Data that is updated very frequently is always cached; that is, the data is permanently stored in memory and included in the buffer cache or in the page cache until ...