← Interview Prep

Linux Kernel — Block Device Drivers

The block layer from page cache to platter: bio → request → request_queue (merge/sort/plug), single-queue vs blk-mq multi-queue, the I/O schedulers (none/mq-deadline/bfq/kyber) and why SSD/NVMe prefer none, queue knobs in /sys/block, and stacked devices (LVM/RAID/dm-crypt).

The path from a cached page to sectors on a disk — the block layer, the request queue, and the I/O schedulers that decide order. Where filesystem I/O actually meets storage. Original, interview-focused notes; builds on I/O Architecture and the Page Cache.

Above: filesystems produce I/O in units of pages/blocks. The block layer packages those into bio requests, batches and orders them in a queue, and hands them to the driver, which DMAs them to the device. Reordering/merging exists because disks reward locality — and SSDs/NVMe change that calculus.

The stack

page cache / direct I/O
      │  submit_bio()
 block layer:  bio → request → request_queue   (merge, sort, schedule)
      │
 device driver  → DMA →  disk / SSD / NVMe

Single-queue → blk-mq

I/O schedulers

SchedulerIdeaBest for
none / noopFIFO, no reorderingFast SSD/NVMe (seeks are free; reordering just adds latency).
mq-deadlineDeadlines per request + sorting; bounds worst-case latencyGeneral SSD/HDD; the safe default.
bfqBudget Fair Queueing — per-process fairness & low latencyDesktops/interactive, HDDs.
kyberSimple latency-target throttlingFast multi-queue devices.

The key point: on a spinning disk, sorting/merging to minimize seeks is a huge win; on SSD/NVMe there's no seek, so heavy scheduling just adds overhead — hence none is often best. Set it via /sys/block/<dev>/queue/scheduler.

Knobs & observability

Likely interview questions

Kernel Internals series. Related: I/O Architecture · Performance Triage.