Zone write locking
A Linux mechanism that serializes covered write requests to the same sequential zone using a per-zone lock.
The upstream Linux 4.16-6.9 implementation resides in deadline or mq-deadline. Zone write plugging replaces it from Linux 6.10. This is not a global I/O order, a device ownership lock or a persistence guarantee, and callers still supply valid offsets. [1]
In Linux 6.9 the block layer keeps one lock bit per sequential zone. The scheduler sets the bit with a test-and-set when it dispatches a write and clears it on completion, so a second write to that zone waits while reads are not serialized. [4] [2]
The first version, in kernel 4.10, lived in the SCSI disk driver, where a locked write stalled the whole dispatch queue including reads and an asynchronous sequential write stream ran at queue depth one. Kernel 4.16 moved it into the deadline and mq-deadline schedulers, which also brought multi-queue support. [1]
Relations
Advantages
- Writers that issue in order avoid unaligned write failures without relying on host adapter command ordering. [1]
Limitations
- Enforcement depended on the deadline and mq-deadline schedulers rather than on the block layer as a whole. [1]
- Each zone has at most one write in flight, which caps per-zone write concurrency. [4]
Citations
- Western Digital, Zoned Storage: Write Ordering Control; locking through Linux 6.9 and plugging from Linux 6.10.
- Linux v6.9, block/mq-deadline.c: deadline_fifo_request, deadline_next_request and request dispatch.
- Linux v6.9 block/blk-zoned.c: per-zone write lock bitmap helpers
Further reading
Sources & caveats
- linux-ordering-docs is the Write Ordering Control page of the zoned storage documentation, reread on the access date.
- blk-zoned-69 is block/blk-zoned.c at tag v6.9, read in the blk_req_zone_write_* helpers and the seq_zones_wlock bitmap.
- linux69-deadline is block/mq-deadline.c at tag v6.9, read where dispatch calls blk_req_zone_write_lock.
- 4.10, 4.16, 6.9, 6.10 and queue depth one come from linux-ordering-docs. One bit per zone comes from blk-zoned-69.