Block devices transfer information one block at a time, while process address spaces (or to be more precise, memory regions allocated for the process) are defined as sets of pages. This mismatch can be hidden to some extent by using page I/O operations (see the section Section 13.5). They may be activated in the following cases:
When swapping in or swapping out, the kernel loads from disk or saves to disk the contents of whole page frames (see Chapter 16).
We'll use the rest of this chapter to describe how these operations are carried out.
A page I/O operation is activated by invoking the brw_page( ) function, which receives the following parameters:
Type of I/O operation (READ or WRITE)
Address of a page descriptor
Block device number
Array of logical block numbers
The page descriptor refers to the page involved in the page I/O operation. It must already be locked (PG_locked flag on) before invoking brw_page( ) so that no other kernel ...