The Life Cycle of Block IO: From Generation to Return
The article walks through the entire block I/O lifecycle in mobile devices—defining block devices, describing how user actions and system processes generate I/O, detailing scheduling, bio-to-request conversion, dispatch via SCSI/UFS, and the interrupt‑driven return path that wakes waiting processes, linking each stage to performance and power metrics.
This article explores the life cycle of block IO, a critical component of storage operations in mobile devices. Block IO is the only path to non-volatile storage and directly impacts device performance, power consumption, and lifespan. The article examines block IO through four stages: generation, scheduling, dispatch, and return.
The article begins by defining block devices and the block device layer, explaining how they enable efficient storage operations. It then details the various scenarios that generate block IO, including user-space file operations, file system read-ahead, dirty page writeback, fsync/sync operations, and direct-IO operations.
The scheduling phase is discussed in depth, covering the overall framework, key data structures (bio, request, page, sector), and the process of converting bio to request. The article explains bio splitting, merging, thread plug/unplug mechanisms, elevator scheduling algorithms, and the relationships between different queues in the multiqueue architecture.
The dispatch phase covers the producer-consumer model, SCSI subsystem integration with UFS devices, key SCSI structures, and the process of obtaining and dispatching IO requests. It also addresses exception handling paths for busy devices and other error conditions.
The return phase explains how controllers generate hardware interrupts, the softirq mechanism, and the file system callback chain that ultimately wakes up waiting processes, completing the block IO life cycle.
The article concludes by relating the block IO life cycle to iowait time statistics, helping readers understand how to analyze performance issues related to storage operations.
OPPO Kernel Craftsman
Sharing Linux kernel-related cutting-edge technology, technical articles, technical news, and curated tutorials
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.