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

Zorro Lang
2025-11-22T07:41:19Z

On Thu, Nov 20, 2025 at 05:08:29PM +0100, cem@kernel.org wrote:
> 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>

Actually from the logic of _create_zloop, these 4 arguments are optional, not
necessary, so the "<...>" should be "[...]"

> _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"

If the "zone_capacity" isn't a new feature which need a _require_ helper to check
it's supported, then this patch looks good to me.

Reviewed-by: Zorro Lang <zlang@redhat.com>

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