[PATCH 1/2] common/zoned: enable passing a custom capacity

cem
2025-11-20T16:09:21Z

From: Carlos Maiolino <cem@kernel.org>

Extend _create_zloop() to accept a custom zone capacity.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
common/zoned | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/zoned b/common/zoned
index 88b81de5db4d..51c011b247d2 100644
--- a/common/zoned
+++ b/common/zoned
@@ -61,7 +61,7 @@ _find_next_zloop()
}

# Create a zloop device
-# usage: _create_zloop <base_dir> <zone_size> <nr_conv_zones>
+# usage: _create_zloop <base_dir> <zone_size> <nr_conv_zones> <zone_capacity>
_create_zloop()
{
local id="$(_find_next_zloop)"
@@ -80,9 +80,13 @@ _create_zloop()
local conv_zones=",conv_zones=$3"
fi

+ if [ -n "$4" ]; then
+ local zone_capacity=",zone_capacity_mb=$4"
+ fi
+
mkdir -p "$zloop_base/$id"

- local zloop_args="add id=$id,base_dir=$zloop_base$zone_size$conv_zones"
+ local zloop_args="add id=$id,base_dir=$zloop_base$zone_size$conv_zones$zone_capacity"

echo "$zloop_args" > /dev/zloop-control || \
_fail "cannot create zloop device"
--
2.51.1