Re: [PATCH blktests v5 1/3] bcache: add bcache/001

Shinichiro Kawasaki <[email protected]> Fri, 6 Mar 2026 12:15:10 +0000
Newsgroups org.kernel.vger.linux-bcache,org.kernel.vger.linux-block
Message-ID <aarDdfJPu1NBuuvM@shinmob>
On Mar 05, 2026 / 16:01, Daniel Wagner wrote:
> So far we are missing tests for bcache. Besides a relative simple
> setup/teardown tests add also the corresponding infrastructure. More
> tests are to be expected to depend on this.
>=20
> _create_bcache/_remove_bcache are tracking the resources and if anything
> is missing it will complain.
>=20
> Signed-off-by: Daniel Wagner <[email protected]>
> ---
>  tests/bcache/001     |  44 ++++++
>  tests/bcache/001.out |   3 +
>  tests/bcache/rc      | 377 +++++++++++++++++++++++++++++++++++++++++++++=
++++++
>  3 files changed, 424 insertions(+)
>=20
> diff --git a/tests/bcache/001 b/tests/bcache/001
> new file mode 100755
> index 000000000000..64d5d45d9e6e
> --- /dev/null
> +++ b/tests/bcache/001
[...]
> +_create_bcache() {
> +	local -a cdevs=3D()
> +	local -a bdevs=3D()
> +	local -a ARGS=3D()
> +	local -a created_devs=3D()
> +	local bucket_size=3D"64k"
> +	local block_size=3D"4k"

[...]

> +	# add /dev prefix to device names
> +	cdevs=3D( "${cdevs[@]/#/\/dev\/}" )
> +	bdevs=3D( "${bdevs[@]/#/\/dev\/}" )

Here, /dev/ prefix is added to arguments of _bcache_wipe_devs() call below.

> +
> +	# make-bcache expects empty/cleared devices
> +	_bcache_wipe_devs "${cdevs[@]}" "${bdevs[@]}"

[...]

> +_remove_bcache() {
> +	local -a cdevs=3D()
> +	local -a bdevs=3D()
> +	local -a csets=3D()
> +	local -a bcache_devs=3D()
> +	local uuid

[...]

> +	local timeout
> +	for cset in "${csets[@]}"; do
> +		timeout=3D0
> +		while [[ -d /sys/fs/bcache/"${cset}" ]] && (( timeout < 10 )); do
> +			sleep 0.5
> +			(( timeout++ ))
> +		done
> +	done

However, /dev prefix is not added here for the _bcache_wipe_devs() call bel=
ow. I
added the hunk below, then observed the nvme?n1 files are no longer created=
 in
my environment.

       # add /dev prefix to device names
       cdevs=3D( "${cdevs[@]/#/\/dev\/}" )
       bdevs=3D( "${bdevs[@]/#/\/dev\/}" )

Other than this, this patch looks good to me. If you are okay with it, I ca=
n
fold-in the change above when I apply this patch.

> +
> +	_bcache_wipe_devs "${cdevs[@]}" "${bdevs[@]}"
> +}=