Enhancing Zoned Storage Support On FreeBSD
Student: Sylvia Dumbrava (SylviaDumbrava)
Mentors: Alan Somers (AlanSomers), Robert Clausecker (RobertClausecker), Kenneth Merry (KenMerry)
Project description
This project aims at improving the Zoned Storage (ZS) landscape in FreeBSD by implementing (or extending) several features. Such features include emulation of ZS (similarly to Linux's null_blk driver) backed by non-zoned GEOM providers, NVMe Zone Namespaces (ZNS) support and extended utilities to account for ZS.
Approach to solving the problem
Implementing ZNS
Implementing ZNS mostly follows Kenneth Merry's 2016 work on SMR storage, extending the existing zone model to account for NVMe and enabling the new command sets in the nvme(4) driver. The nda(4) driver will be the main recipient of ZNS changes (e.g. BIO_ZONE handling) due to nvd(4)'s barebones nature.
Implementing emulated Zoned Storage
Emulation of Zoned Storage, backed by any, non-zoned GEOM provider, is implemented thanks to a new gzoned(8) GEOM driver. The new driver includes:
- Configuration of zones sizes and types (sequential write only or conventional) spanning an entire drive.
- "Fault injection" for setting faulty zone conditions (OFFLINE/READ ONLY/RWP Recommended)
- Configuration of the maximum amount of open zones and the URSWRZ bit.
Drives must be set up for zoning through the geom zoned create command. It uses metadata at the end of a (non-zoned) drive which is persistent across reboots.
Extending existing tools
As of today, some tools like the GEOM class gpart(8) are not designed to handle ZS properly. An example of this is the inability of applying the GPT partitioning scheme to a zoned device, with gpart attempting to write the primary partition table in a non-strictly-ascending LBA order, along with the GPT backup partition table on sequential-write-required zones at the end of the drive (the write pointer would have to jump at the end of the drive).
Problems regarding such utilities can be handled based on existing bugs or possible use-cases related to ZS.
Deliverables
Emulating zoned drives backed by regular storage (gzoned(8)).
Extending existing tools e.g. gpart(8), glabel(8) and gconcat(8) for better handling of Zoned Storage.
- Implementing ZNS support.
Milestones
- May 26st: Start of coding and further code exploration.
- July 4th: gzoned(8) driver implemented.
- July 9th: gpart(8) and glabel(8) extended for ZS.
- July 20th: gconcat(8) extended for ZS.
- August 10th: ZNS implemented.
- August 15th: All tests pass w.r.t implemented features.
- August 20th: Documentation/manual pages complete.
- August 24th: End of coding (hard).
Test Plan
Testing is done through Kyua + ATF-sh(3) e.g. kyua test -k /usr/tests/sys/geom/class/zoned/Kyuafile; used to verify functionality and zone model conformance without affecting other tests. ZNS testing involves using real (and emulated) ZNS hardware to verify its behaviour against the existing zoned featureset (excluding ZNS exceptions, e.g. URSWRZ).
Many thanks to AlanSomers for the initial test stubs and guidance.
The Code
GitHub: https://github.com/voidanix/freebsd-src.git
Notes
Current feature status:
Feature
Status
Notes
Implement gzoned(8)
Done
GitHub PR (blocking PR for other features)
Extend gzoned(8) for conventional zones
Done
Extend gpart(8)
Done
Extending for GPT only
Extend glabel(8)
Done
Extend gconcat(8)
Done
ZNS support
Done
Tested on QEMU ZNS/NVMe emulator and WD Ultrastar DC ZN540 (access kindly provided by Spectra Logic)
Current tests status:
Test
Status
Notes
gzoned(8)
Done
gpart(8)
Done
glabel(8)
Done
gconcat(8)
Done
ZNS
In-Progress
Useful links
Linux null_blk zoning implementation
Introduction of SMR support in FreeBSD
Emulating ZNS devices through QEMU
GEOM BIO controlling functions
Introduction to writing GEOM classes
NVMe specifications (includes ZNS/Base/NVM command set/etc.)