Chapter 16. Block Drivers
So far, our discussion has been limited to char drivers. There are other types of drivers in Linux systems, however, and the time has come for us to widen our focus somewhat. Accordingly, this chapter discusses block drivers.
A block driver provides access to devices that transfer randomly accessible data in fixed-size blocks—disk drives, primarily. The Linux kernel sees block devices as being fundamentally different from char devices; as a result, block drivers have a distinct interface and their own particular challenges.
Efficient block drivers are critical for performance—and not just for
explicit reads and writes in user applications. Modern systems with virtual memory work by
shifting (hopefully) unneeded data to secondary storage, which is usually a disk drive. Block
drivers are the conduit between core memory and secondary storage; therefore, they can be seen
as making up part of the virtual memory subsystem. While it is possible to write a block
driver without knowing about struct
page and other important memory concepts, anybody needing
to write a high-performance driver has to draw upon the material covered in Chapter 15.
Much of the design of the block layer is centered on performance. Many char devices can run below their maximum speed, and the performance of the system as a whole is not affected. The system cannot run well, however, if its block I/O subsystem is not well-tuned. The Linux block driver interface allows you to get the most out of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access