One of the two disk caches dynamically set aside in a certain proportion of available memory by the Linux kernel. The buffer cache is made up of lots of buffers (sections of RAM), each of which is associated with a single arbitrary block on a block device (say a hard disk for example). Each buffer consists of a buffer_head data structure and an area of memory equal to the block size of the associated device, used to hold data.
To minimise the CPU overhead involved in maintaining the buffer cache, all the buffers are held in one of several linked lists. Each of the linked lists contains buffers in the same state; unused, free, clean, dirty, locked etc.
In order to gain a significant performance benefit using a cache, the process of checking the buffer cache for a particular buffer must be as efficient as possible. Every time a call to read() is made, the buffer cache must be checked for the required block(s) first. To enable buffers to be found quickly, a hash table is maintained, containing all the buffers present in the cache. The getblk() function is the main service routine for the buffer cache; it performs the functions described above.
The buffer cache can also be used to improve the disk writing performance of the system. Instead of carrying out all writes immediately, the kernel stores data to be written in the buffer cache, waiting to see if the writes can be grouped together to minimise disk head movement. A buffer that contains data that is waiting to be written to disk is termed "dirty". A field in the buffer head data structure indicates if a particular page is dirty or not.