local dev=$1
echo "Checking for HW-wrapped key support on $dev" >> $seqres.full
- local sysfs_dir=$(_sysfs_dev $dev)
- if [ ! -e $sysfs_dir/queue ]; then
- sysfs_dir=$sysfs_dir/..
- fi
- if [ ! -e $sysfs_dir/queue/crypto/hw_wrapped_keys ]; then
+ local queue_path=$(_sysfs_queue_path $dev)
+ if [ $? -ne 0 ] || [ ! -e $queue_path/crypto/hw_wrapped_keys ]; then
_notrun "$dev doesn't support hardware-wrapped inline encryption keys"
fi
{
local sysfs="/sys/block/$(_short_dev $SCRATCH_DEV)"
test -e "${sysfs}/dax" && return 0
- test "$(cat "${sysfs}/queue/dax" 2>/dev/null)" = "1" && return 0
+
+ local queue_path=$(_sysfs_queue_path $SCRATCH_DEV)
+ if [ $? -eq 0 ]; then
+ test "$(cat "${queue_path}/dax" 2>/dev/null)" = "1" && return 0
+ fi
return 1
}
echo "Usage: _zone_type <device>"
_exit 1
fi
- local sdev=`_short_dev $target`
- if [ -e /sys/block/${sdev}/queue/zoned ]; then
- cat /sys/block/${sdev}/queue/zoned
+ local queue_path=$(_sysfs_queue_path $target)
+ if [ $? -eq 0 ] && [ -e "$queue_path/zoned" ]; then
+ cat "$queue_path/zoned"
else
echo none
fi
test -z "$bdev" && return
test -b "$bdev" || return
- local sysfs_bdev="$(_sysfs_dev "$bdev")"
-
REPORT_VARS["${bdev_var}_SIZE_KB"]="$(( "$(blockdev --getsz "$bdev")" / 2 ))"
- REPORT_VARS["${bdev_var}_ROTATIONAL"]="$(cat "$sysfs_bdev/queue/rotational" 2>/dev/null)"
- REPORT_VARS["${bdev_var}_DAX"]="$(cat "$sysfs_bdev/queue/dax" 2>/dev/null)"
- REPORT_VARS["${bdev_var}_DISCARD"]="$(sed -e 's/[1-9][0-9]*/1/g' "$sysfs_bdev/queue/discard_max_bytes" 2>/dev/null)"
- REPORT_VARS["${bdev_var}_WRITE_ZEROES"]="$(sed -e 's/[1-9][0-9]*/1/g' "$sysfs_bdev/queue/write_zeroes_max_bytes" 2>/dev/null)"
- REPORT_VARS["${bdev_var}_PHYS_BLOCK_BYTES"]="$(cat "$sysfs_bdev/queue/physical_block_size" 2>/dev/null)"
- REPORT_VARS["${bdev_var}_LBA_BYTES"]="$(cat "$sysfs_bdev/queue/logical_block_size" 2>/dev/null)"
- REPORT_VARS["${bdev_var}_ZONES"]="$(cat "$sysfs_bdev/queue/nr_zones" 2>/dev/null)"
+
+ local queue_path="$(_sysfs_queue_path "$bdev")"
+ if [ $? -eq 0 ]; then
+ REPORT_VARS["${bdev_var}_ROTATIONAL"]="$(cat "$queue_path/rotational" 2>/dev/null)"
+ REPORT_VARS["${bdev_var}_DAX"]="$(cat "$queue_path/dax" 2>/dev/null)"
+ REPORT_VARS["${bdev_var}_DISCARD"]="$(sed -e 's/[1-9][0-9]*/1/g' "$queue_path/discard_max_bytes" 2>/dev/null)"
+ REPORT_VARS["${bdev_var}_WRITE_ZEROES"]="$(sed -e 's/[1-9][0-9]*/1/g' "$queue_path/write_zeroes_max_bytes" 2>/dev/null)"
+ REPORT_VARS["${bdev_var}_PHYS_BLOCK_BYTES"]="$(cat "$queue_path/physical_block_size" 2>/dev/null)"
+ REPORT_VARS["${bdev_var}_LBA_BYTES"]="$(cat "$queue_path/logical_block_size" 2>/dev/null)"
+ REPORT_VARS["${bdev_var}_ZONES"]="$(cat "$queue_path/nr_zones" 2>/dev/null)"
+ fi
}
__import_report_vars() {
_require_limited_active_zones() {
local dev=$1
- local sysfs=$(_sysfs_dev ${dev})
- local attr="${sysfs}/queue/max_active_zones"
+ local queue_path=$(_sysfs_queue_path ${dev})
+ [ $? -ne 0 ] && _notrun "cannot find queue path: $queue_path"
+ local attr="${queue_path}/max_active_zones"
[ -e "${attr}" ] || _notrun "cannot find queue/max_active_zones. Maybe non-zoned device?"
if [ $(cat "${attr}") == 0 ]; then
# An extent size can be up to BTRFS_MAX_UNCOMPRESSED
max_extent_size=$(( 128 * 1024 ))
if _scratch_btrfs_is_zoned; then
- zone_append_max=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/zone_append_max_bytes")
- if [[ $zone_append_max -gt 0 && $zone_append_max -lt $max_extent_size ]]; then
- # Round down to PAGE_SIZE
- max_extent_size=$(( $zone_append_max / 4096 * 4096 ))
+ queue_path=$(_sysfs_queue_path $SCRATCH_DEV)
+ if [ $? -eq 0 ]; then
+ zone_append_max=$(cat "$queue_path/zone_append_max_bytes")
+ if [[ $zone_append_max -gt 0 && $zone_append_max -lt $max_extent_size ]]; then
+ # Round down to PAGE_SIZE
+ max_extent_size=$(( $zone_append_max / 4096 * 4096 ))
+ fi
fi
fi
file_size=$(( 10 * 1024 * 1024 ))
$BLKZONE_PROG report $SCRATCH_DEV | grep -q -e "nw" && \
_notrun "test is unreliable on devices with conventional zones"
-sdev="$(_short_dev $SCRATCH_DEV)"
-zone_size=$(($(cat /sys/block/${sdev}/queue/chunk_sectors) << 9))
+queue_path=$(_sysfs_queue_path $SCRATCH_DEV) || \
+ _notrun "Failed to get queue path: $queue_path"
+zone_size=$(($(cat "$queue_path/chunk_sectors") << 9))
fssize=$((zone_size * 16))
devsize=$(($(_get_device_size $SCRATCH_DEV) * 1024))
# Create a minimal FS to kick the reclaim process
# enabled.
_require_no_compress
-max_active=$(cat $(_sysfs_dev ${SCRATCH_DEV})/queue/max_active_zones)
+queue_path=$(_sysfs_queue_path ${SCRATCH_DEV}) || \
+ _notrun "Failed to get queue path: $queue_path"
+max_active=$(cat "$queue_path/max_active_zones")
# Fill the zones leaving the last 1MB
fill_active_zones() {
extent_size=$(( 128 * 1024 ))
if _scratch_btrfs_is_zoned; then
- zone_append_max=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/zone_append_max_bytes")
+ queue_path=$(_sysfs_queue_path $SCRATCH_DEV) ||
+ _notrun "Couldn't find queue path for zoned device"
+ zone_append_max=$(cat "$queue_path/zone_append_max_bytes")
if [[ $zone_append_max -gt 0 && $zone_append_max -lt $extent_size ]]; then
_notrun "zone append max $zone_append_max is smaller than wanted extent size $extent_size"
fi