Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 9: The Extended Filesystem Family


Fields not shown are automatically initialized withNULLpointers by the compiler.


The inode operations are initialized as follows for regular files:


fs/ext2/file.c
struct inode_operations ext2_file_inode_operations = {
.truncate = ext2_truncate,
.setxattr = generic_setxattr,
.getxattr = generic_getxattr,
.listxattr = ext2_listxattr,
.removexattr = generic_removexattr,
.setattr = ext2_setattr,
.permission = ext2_permission,
};

More inode operations are available for directories.


fs/ext2/namei.c
struct inode_operations ext2_dir_inode_operations = {
.create = ext2_create,
.lookup = ext2_lookup,
.link = ext2_link,
.unlink = ext2_unlink,
.symlink = ext2_symlink,
.mkdir = ext2_mkdir,
.rmdir = ext2_rmdir,
.mknod = ext2_mknod,
.rename = ext2_rename,
.setxattr = generic_setxattr,
.getxattr = generic_getxattr,
.listxattr = ext2_listxattr,
.removexattr = generic_removexattr,
.setattr = ext2_setattr,
.permission = ext2_permission,
};

Filesystem and block layers are linked by theaddress_space_operationsdiscussed in Chapter 4. In the
Ext2 filesystem, these operations are filled with the following entries^13 :


fs/ext2/inode.c
struct address_space_operations ext2_aops = {
.readpage = ext2_readpage,
.readpages = ext2_readpages,
.writepage = ext2_writepage,
.sync_page = block_sync_page,
.write_begin = ext2_write_begin,
.write_end = generic_write_end,
.bmap = ext2_bmap,
.direct_IO = ext2_direct_IO,
.writepages = ext2_writepages,
};

(^13) There is a second version of address space operations namedext2_nobh_aops; it contains only functions in which the page
cache manages withoutbuffer_heads. These functions are used (predominantly on machines with gigantic RAM configurations)
when the mount optionnobhis specified. This is a seldom used option not discussed here.

Free download pdf