Block Device Drivers
Block device drivers are the lowest component of the Linux block subsystem. They get requests from I/O scheduler, and do whatever is required to process them.
Block device drivers are, of course, integrated within the device
driver model described in the section "The Device Driver Model" in
Chapter 13. Therefore, each
of them refers to a device_driver
descriptor; moreover, each disk handled by the driver is associated with
a device descriptor. These
descriptors, however, are rather generic: the block I/O subsystem must
store additional information for each block device in the system.
Block Devices
A block device driver may handle several block devices. For instance, the IDE device driver can handle several IDE disks, each of which is a separate block device. Furthermore, each disk is usually partitioned, and each partition can be seen as a logical block device. Clearly, the block device driver must take care of all VFS system calls issued on the block device files associated with the corresponding block devices.
Each block device is represented by a block_device descriptor, whose fields are
listed in Table
14-9.
Table 14-9. The fields of the block device descriptor
Type | Field | Description |
|---|---|---|
| | Major and minor numbers of the block device |
| | Pointer to the inode of the file associated with the block device in the bdev filesystem |
| | Counter of how many times the block device has been opened |
| | Semaphore ... |
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