This type of address space must not be confused with the virtual and physical address spaces provided by the system or processor It is a separate abstraction of the Linux kernel that unfortunately bears the same name

Initially, we are interested in only one aspect. Each address space has a ''host''from which it obtains its data. In most cases, these are inodes that represent just one file.2 Because all existing inodes are linked with their superblock (as discussed in Chapter 8), all the kernel need do is scan a list of all superblocks and follow their associated inodes to obtain a list of cached pages.

Usually, modifications to files or other objects cached in pages change only part and not the whole of the page contents. This gives rise to a problem when data are synchronized; it doesn't make sense to write

2Since the majority of cached pages result from file accesses, most host objects, indeed, represent a regular file. It is, however, also possible that an inode host object stems from the pseudo-block device filesystem. In this case, the address space is not associated with a single file, but with a whole block device or a partition thereof.

the entire page back to the block device because most of the page data in memory are still synchronized with the data on the block device. To save time, the kernel divides each page in the cache into smaller units known as buffers during write operations. When data are synchronized, the kernel is able to restrict writeback to the smaller units that have actually been modified. As a result, the basically sound idea of page caching is not compromised in any way.

Continue reading here: Structure of the Buffer Cache

Was this article helpful?

0 0