IBM REDP-4285-00 User Manual

Page of 170
Chapter 1. Understanding the Linux operating system 
23
Draft Document for Review May 4, 2007 11:35 am
4285ch01.fm
Figure 1-21   Flushing dirty buffers
1.4.3  Block layer
The block layer handles all the activity related to block device operation (refer to Figure 1-18 
on page 20
). The key data structure in the block layer is the 
bio
 structure. The bio structure is 
an interface between file system layer and block layer.
When a write is performed, file system layer tries to write to page cache which is made up of 
block buffers. It makes up a bio structure by putting the contiguous blocks together, then 
sends bio to the block layer. (refer to Figure 1-18 on page 20)
The block layer handles the bio request and links these requests into a queue called the I/O 
request queue. This linking operation is called 
I/O elevator
. In Linux kernel 2.6 
implementations, four types of I/O elevator algorithms are available. These are described 
below.
Block sizes
The block size, the smallest amount of data that can be read or written to a drive, can have a 
direct impact on a server’s performance. As a guideline, if your server is handling many small 
files, then a smaller block size will be more efficient. If your server is dedicated to handling 
large files, a larger block size may improve performance. Block sizes cannot be changed on 
the fly on existing file systems, and only a reformat will modify the current block size.
I/O elevator
Apart from a vast amount of other features, the Linux kernel 2.6 employs a new I/O elevator 
model. While the Linux kernel 2.4 used a single, general-purpose I/O elevator, kernel 2.6 
offers the choice of four elevators. Because the Linux operating system can be used for a 
wide range of tasks, both I/O devices and workload characteristics change significantly. A 
Process
Cache
Data
Disk
Data
read
Process
Cache
Disk
Data
write
Data
dirty buffer
• Process read a data from disk
The data on memory and the data on disk are identical at this time.
• Process writes a new data
Only the data on memory has been changed, the data on disk and the data on memory is not the identical.
Process
Cache
Disk
Data
flush
• Flushing writes the data on memory to the disk.
The data on disk is now identical to the data on memory.
Data
•pdflush
•sync()