From: Naohiro Aota <Naohiro.Aota@wdc.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
Zorro Lang <zlang@redhat.com>
Cc: hch <hch@lst.de>, Naohiro Aota <Naohiro.Aota@wdc.com>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
Hans Holmberg <Hans.Holmberg@wdc.com>,
"fstests@vger.kernel.org" <fstests@vger.kernel.org>,
"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
Carlos Maiolino <cem@kernel.org>,
"Darrick J . Wong" <djwong@kernel.org>
Subject: Re: [PATCH v3 2/3] common/zoned: add _create_zloop
Date: Tue, 14 Oct 2025 09:04:17 +0000 [thread overview]
Message-ID: <DDHXAL6EI91X.SKILMOTMNDQO@wdc.com> (raw)
In-Reply-To: <20251013080759.295348-3-johannes.thumshirn@wdc.com>
On Mon Oct 13, 2025 at 5:07 PM JST, Johannes Thumshirn wrote:
> Add _create_zloop a helper function for creating a zloop device.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> common/zoned | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/common/zoned b/common/zoned
> index 41697b08..59bebcae 100644
> --- a/common/zoned
> +++ b/common/zoned
> @@ -45,3 +45,32 @@ _require_zloop()
> _notrun "This test requires zoned loopback device support"
> fi
> }
> +
> +_find_next_zloop()
> +{
> + local last_id=$(ls /dev/zloop* 2> /dev/null | grep -E "zloop[0-9]+" | wc -l)
> + echo $last_id
> +}
This one does not work if well one of a non-end zloop device is removed.
So, how about something like this?
while true; do
if [[ ! -b /dev/zloop$id ]]; then
break
fi
id=$(( id + 1 ))
done
> +
> +# Create a zloop device
> +# useage: _create_zloop [id] <base_dir> <zone_size> <nr_conv_zones>
> +_create_zloop()
Thinking of the compatibility with _create_loop_device(), it would be good
to return the device name.
> +{
> + local id=$1
So, I think we can just grab an ID here as above, and
> +
> + if [ -n "$2" ]; then
> + local base_dir=",base_dir=$2"
> + fi
> +
> + if [ -n "$3" ]; then
> + local zone_size=",zone_size_mb=$3"
> + fi
> +
> + if [ -n "$4" ]; then
> + local conv_zones=",conv_zones=$4"
> + fi
mkdir -p $base_dir/$id here. I think it's enough to run a workload on an empty
zloop device.
Or, should we also support creating a zloop device from an existing file
structure?
> +
> + local zloop_args="add id=$id$base_dir$zone_size$conv_zones"
> +
> + echo "$zloop_args" > /dev/zloop-control
> +}
next prev parent reply other threads:[~2025-10-14 9:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 8:07 [PATCH v3 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
2025-10-13 8:07 ` [PATCH v3 1/3] common/zoned: add _require_zloop Johannes Thumshirn
2025-10-13 8:43 ` Naohiro Aota
2025-10-14 4:33 ` Christoph Hellwig
2025-10-13 8:07 ` [PATCH v3 2/3] common/zoned: add _create_zloop Johannes Thumshirn
2025-10-14 9:04 ` Naohiro Aota [this message]
2025-10-13 8:07 ` [PATCH v3 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
2025-10-13 13:55 ` Anand Jain
2025-10-13 14:06 ` Johannes Thumshirn
2025-10-13 14:42 ` Anand Jain
2025-10-14 4:30 ` hch
2025-10-14 14:38 ` Anand Jain
2025-10-15 4:09 ` hch
2025-10-14 4:33 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DDHXAL6EI91X.SKILMOTMNDQO@wdc.com \
--to=naohiro.aota@wdc.com \
--cc=Hans.Holmberg@wdc.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=hch@lst.de \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=zlang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox