Re: [PATCH v2 4/6] t/zbd: Support testing zone capacity smaller than zone size

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

 



On 2020/07/17 15:59, Shinichiro Kawasaki wrote:
> On Jul 17, 2020 / 02:01, Damien Le Moal wrote:
>> On 2020/07/15 15:41, Shin'ichiro Kawasaki wrote:
>>> From: Hans Holmberg <hans.holmberg@xxxxxxx>
>>>
>>> Add support for testing zoned block devices where zone capacity is less
>>> than zone size. If the test case runs sequential workloads or workloads
>>> with verify, use zone capacity instead of zone size to complete.
>>>
>>> To use zone capacity of the test target zones, introduce a helper
>>> function total_zone_capacity() which sums up zone capacity numbers of the
>>> test target zones.
>>>
>>> Signed-off-by: Hans Holmberg <hans.holmberg@xxxxxxx>
>>> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>
>>> ---
>>>  t/zbd/functions        |  37 +++++++++++++++
>>>  t/zbd/test-zbd-support | 100 ++++++++++++++++++++++++++---------------
>>>  2 files changed, 102 insertions(+), 35 deletions(-)
>>>
>>> diff --git a/t/zbd/functions b/t/zbd/functions
>>> index 344836c8..82d64f5c 100644
>>> --- a/t/zbd/functions
>>> +++ b/t/zbd/functions
>>> @@ -84,6 +84,43 @@ first_sequential_zone() {
>>>      fi
>>>  }
>>>  
>>> +# Reports the summed zone capacity of $1 number of zones starting from offset $2
>>> +# on device $3.
>>> +total_zone_capacity() {
>>> +	local nr_zones=$1
>>> +	local sector=$(($2 / 512))
>>> +	local dev=$3
>>> +	local capacity=0 num
>>> +	local grep_str
>>> +
>>> +	if [ -z "$is_zbd" ]; then
>>> +		# For regular block devices, handle zone size as zone capacity.
>>> +		echo $((zone_size * nr_zones))
>>> +		return
>>> +	fi
>>> +
>>> +	if [ -n "${blkzone}" ] && [ ! -n "${use_libzbc}" ]; then
>>> +		if blkzone_reports_capacity "${dev}"; then
>>> +			grep_str='cap \K[0-9a-zA-Z]*'
>>> +		else
>>> +			# If zone capacity is not reported, refer zone length.
>>> +			grep_str='len \K[0-9a-zA-Z]*'
>>> +		fi
>>> +		while read num; do
>>> +			capacity=$((capacity + num))
>>> +		done < <(${blkzone} report -c "$nr_zones" -o "$sector" "$dev" |
>>> +				grep -Po "${grep_str}")
>>
>> Why the space in "< <" ? Why not "<<" ?
> 
> "<()" is the bash syntax "process substitution". To separate it from redirect, a
> space is required between "<" and "<()".

Ah. Yes. I missed that... For some reason, I assumed that the loop input needed
"<<" :)


> 
> Other than this, I will reflect all of your comments to v3. Thank you for the
> valuable comments.
> 


-- 
Damien Le Moal
Western Digital Research




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux