Ext2 Methods

Many of the VFS methods described in Chapter 12 have a corresponding Ext2 implementation. Since it would take a whole book to describe all of them, we limit ourselves to briefly reviewing the methods implemented in Ext2. Once the disk and the memory data structures are clearly understood, the reader should be able to follow the code of the Ext2 functions that implement them.

Ext2 Superblock Operations

Many VFS superblock operations have a specific implementation in Ext2, namely read_inode, write_inode, put_inode, delete_inode, put_super, write_super, statfs, and remount_fs. The addresses of the superblock methods are stored into the ext2_sops array of pointers.

Ext2 Inode Operations

Some of the VFS inode operations have a specific implementation in Ext2, which depends on the type of the file to which the inode refers.

If the inode refers to a regular file, all inode operations listed in the ext2_file_inode_operations table have a NULL pointer, except for the truncate operation that is implemented by the ext2_truncate( ) function. Recall that the VFS uses its own generic functions when the corresponding Ext2 method is undefined (a NULL pointer).

If the inode refers to a directory, most inode operations listed in the ext2_dir_inode_operations table are implemented by specific Ext2 functions (see Table 17-8).

Table 17-8. Ext2 inode operations for directory files

VFS inode operation

Ext2 directory inode method

create

ext2_create( )

lookup

ext2_lookup( )

Get Understanding the Linux Kernel, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.