Reading and Generating Data and Indirection Blocks
Once the filesystem has been mounted, user processes can invoke the functions in Chapter 8 to access file contents. The required system calls are first forwarded to the VFS layer, which, depending on file type, invokes the appropriate routine of the underlying filesystem.
As mentioned at the beginning of this section, a large number of low-level functions are available for this purpose. Not all variants are discussed in detail here but only the central basic actions that make up the major part of the code in user applications — generating, opening, reading, closing, and deleting files and directory objects. Both file-specific and inode-specific operations are used to this end. Often the virtual filesystem provides default actions (such as generic_file_read and generic_file_mmap); these use only a few elementary functions of the low-level filesystem to perform higher abstracted tasks. This discussion is restricted to the required interfaces of the Ext2 file system "upward" to the virtual filesystem; these include primarily the reading and writing of data blocks associated with a specific position in a file. From the VFS perspective, the purpose of a filesystem is to establish the link between file contents and the corresponding blocks on the associated storage medium.
Finding Data Blocks ext2_get_block is the key function for associating the Ext2 implementation with the default functions of the virtual filesystem. It should be remembered that all filesystems wishing to use the VFS standard functions must define a function of type get_block_t with the following signature:
Continue reading here: Info
Was this article helpful?