Standard Functions

Useful resources of the VFS layer are the standard functions provided to read and write data. These operations are more or less identical for all filesystems. If the blocks in which the data reside are known, the page cache is first consulted. If the data are not held there, a read request is submitted to the relevant block device. Implementing these operations for every single filesystem would result in a massive duplication of code that must be prevented at all costs.

Most filesystems include the do_sync_read24 and do_sync_write standard routines in the read and write pointers of their file_operations instance.

The routines are strongly associated with other kernel subsystems (block layer and page cache in particular) and must also handle many potential flags and special situations. As a result, their implementation is not always the source of true clarity and sublimeness (comment in the kernel: this is really ugly ... ). For this reason, I examine slightly simplified versions below; these focus on the main path usually traversed so that important aspects are not obscured by a wealth of details. Nevertheless, I have still found it necessary to make many references to routines in other chapters (and in other subsystems).

Continue reading here: Mmfilemapc

Was this article helpful?

0 0