Re: [PATCH blktests v1 17/18] nvme: don't assume namespace id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 21, 2024 at 10:47:26AM +0100, Daniel Wagner wrote:
 --- a/tests/nvme/029
> +++ b/tests/nvme/029
> @@ -53,16 +53,12 @@ test() {
>  
>  	_setup_nvmet
>  
> -	local nvmedev
>  	local reset_nr_hugepages=false
>  
>  	_nvmet_target_setup
>  
>  	_nvme_connect_subsys
>  
> -	nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
> -	_check_uuid "${nvmedev}"
> -
>  	# nvme-cli may fail to allocate linear memory for rather large IO buffers.
>  	# Increase nr_hugepages to allow nvme-cli to try the linear memory allocation
>  	# from HugeTLB pool.
> @@ -72,7 +68,7 @@ test() {
>  		reset_nr_hugepages=true
>  	fi
>  
> -	local dev="/dev/${nvmedev}n1"
> +	local dev="/dev/$(_find_nvme_ns "${def_subsys_uuid}")"

make check complains here, the declaration and assignment should be a
separate step. I've fixed this up

> +_find_nvme_ns() {
> +	local subsys_uuid=$1
> +	local uuid
> +	local ns
> +
> +	for ns in "/sys/block/nvme"* ; do
> +		# ignore nvme channel block devices
> +		if ! [[ "${ns}" =~ nvme[0-9]+n[0-9]+ ]]; then
> +			continue
> +		fi
> +		[ -e "${ns}/uuid" ] || continue
> +		uuid=$(cat "${ns}/uuid")
> +		if [[ "${subsys_uuid}" == "${uuid}" ]]; then
> +			echo "$(basename ${ns})"

The echo is not necessary, I've dropped it.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux