blob: eed0082a15cf9991b0e7aee32ce1bed715f23887 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#
# Common zoned block device specific functions
#
#
# blkzone report added zone capacity to be printed from v2.37.
# This filter will add an extra column 'cap' with the same value of
# 'len'(zone size) for blkzone version < 2.37
#
# Before: start: 0x000100000, len 0x040000, wptr 0x000000 ..
# After: start: 0x000100000, len 0x040000, cap 0x040000, wptr 0x000000 ..
_filter_blkzone_report()
{
$AWK_PROG -F "," 'BEGIN{OFS=",";} $3 !~ /cap/ {$2=$2","$2;} {print;}' |\
sed -e 's/len/cap/2'
}
_require_limited_active_zones() {
local dev=$1
local sysfs=$(_sysfs_dev ${dev})
local attr="${sysfs}/queue/max_active_zones"
[ -e "${attr}" ] || _notrun "cannot find queue/max_active_zones. Maybe non-zoned device?"
if [ $(cat "${attr}") == 0 ]; then
_notrun "this test requires limited active zones"
fi
}
_zone_capacity() {
local phy=$1
local dev=$2
[ -z "$dev" ] && dev=$SCRATCH_DEV
size=$($BLKZONE_PROG report -o $phy -l 1 $dev |\
_filter_blkzone_report |\
grep -Po "cap 0x[[:xdigit:]]+" | cut -d ' ' -f 2)
echo $((size << 9))
}
|