path: root/engines/libzbc.c
diff options
authorShin'ichiro Kawasaki <>2020-07-17 18:36:32 +0900
committerJens Axboe <>2020-07-21 09:17:29 -0600
commit236d23a86d6e3c14b700496e0f196f88513a5f3e (patch)
treefc96baccbcc54a66e678efbf15276696e8015d2b /engines/libzbc.c
parentd13596b225baf61425a9ca92b0583fc3fa97765d (diff)
zbd: Support zone capacity smaller than zone size
NVMe ZNS specification defines zone capacity. The report zone interface of Linux kernel supports it. This patch adds support for this new interface. Modify configure to check availability of BLK_ZONE_REP_CAPACITY flag as well as blkzoned.h header only when target OS is Linux. If this flag is defined and set in the report zone, all sectors from the zone capacity up to the zone size are not accessible. Prevent read and write operations to these sectors by modifying zbd_adjust_block(). Of note is that this skips the region between zone capacity and zone size then reduces total I/O bytes of sequential workloads. Introduce helper functions zbd_zone_end() and zbd_zone_capacity_end() to improve readability of zone limit check code. Reviewed-by: Damien Le Moal <> Signed-off-by: Aravind Ramesh <> Signed-off-by: Hans Holmberg <> Signed-off-by: Shin'ichiro Kawasaki <> Signed-off-by: Jens Axboe <>
Diffstat (limited to 'engines/libzbc.c')
1 files changed, 5 insertions, 0 deletions
diff --git a/engines/libzbc.c b/engines/libzbc.c
index fdde8ca6..4b900233 100644
--- a/engines/libzbc.c
+++ b/engines/libzbc.c
@@ -235,6 +235,11 @@ static int libzbc_report_zones(struct thread_data *td, struct fio_file *f,
zbdz->start = zones[i].zbz_start << 9;
zbdz->len = zones[i].zbz_length << 9;
zbdz->wp = zones[i].zbz_write_pointer << 9;
+ /*
+ * ZBC/ZAC do not define zone capacity, so use the zone size as
+ * the zone capacity.
+ */
+ zbdz->capacity = zbdz->len;
switch (zones[i].zbz_type) {