[PATCH 02/12] zbd: set norandommap=1 when zonemode=zbd is specified

Shin'ichiro Kawasaki <[email protected]> Fri, 9 Jan 2026 11:35:53 +0900
Newsgroups org.kernel.vger.fio
Message-ID <[email protected]>
The random map functionality relies on the minimum block size to manage
the map of written blocks, in order to ensure that all blocks are
written with a random workload. This is normally fine, but in the case
of a zoned block devices being written with a minimum block size that is
not aligned with the zone size or the write pointer position at workload
start, the last blocks of a zone can only be written using a write
operation with a size smaller than the minimum block size. This
conflicts with the random map operation.

In preparation for supporting writing a zone remainder smaller than the
minimum block size without using a zone finish operation, disable the
random map feature by setting norandommap=1 when zonemode=zbd is
specified.

Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
---
 init.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/init.c b/init.c
index 76e1a86d..9320bca8 100644
--- a/init.c
+++ b/init.c
@@ -665,6 +665,19 @@ static int fixup_options(struct thread_data *td)
 		ret |= 1;
 	}
 
+	if (o->zone_mode == ZONE_MODE_ZBD) {
+		if (fio_option_is_set(o, norandommap)) {
+			if (o->norandommap == 0) {
+				log_err("fio: zonemode=zbd requires norandommap=1\n");
+				ret |= 1;
+			}
+			/* if == 1, OK */
+		} else {
+			dprint(FD_ZBD, "fio: zonemode=zbd sets norandommap=1\n");
+			o->norandommap = 1;
+		}
+	}
+
 	if (o->zone_mode == ZONE_MODE_STRIDED && !o->zone_size) {
 		log_err("fio: --zonesize must be specified when using --zonemode=strided.\n");
 		ret |= 1;
-- 
2.49.0