test/nvme_perf: add bdev io cache and pool size option

Allow to set custom size of bdev IO cache and pool
sizes.

Change-Id: I574d1e949f705d8f834539d5879f0a1e72865e00
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3297
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Karol Latecki 2020-07-10 17:51:47 +02:00 committed by Tomasz Zawadzki
parent f8cf17f58e
commit ae4c75b20d
2 changed files with 33 additions and 4 deletions

View File

@ -29,6 +29,8 @@ REPEAT_NO=3
FIO_BIN=$CONFIG_FIO_SOURCE_DIR/fio
PLUGIN="nvme"
DISKCFG=""
BDEV_CACHE=""
BDEV_POOL=""
DISKNO="ALL"
CPUS_ALLOWED=1
NOIOSCALING=false
@ -74,11 +76,35 @@ function discover_bdevs() {
function create_spdk_bdev_conf() {
local output
local disk_cfg
local bdev_json_cfg
local bdev_io_cache_size=$1
local bdev_io_pool_size=$2
local bdev_json_cfg=()
local bdev_opts=()
disk_cfg=($(grep -vP "^\s*#" "$DISKCFG"))
bdev_json_cfg=()
if [[ -n "$bdev_io_cache_size" ]]; then
bdev_opts+=("\"bdev_io_cache_size\": $bdev_io_cache_size")
fi
if [[ -n "$bdev_io_pool_size" ]]; then
bdev_opts+=("\"bdev_io_pool_size\": $bdev_io_pool_size")
fi
local IFS=","
if [[ ${#bdev_opts[@]} -gt 0 ]]; then
bdev_json_cfg+=("$(
cat <<- JSON
{
"method": "bdev_set_options",
"params": {
${bdev_opts[*]}
}
}
JSON
)")
fi
for i in "${!disk_cfg[@]}"; do
bdev_json_cfg+=("$(
cat <<- JSON
@ -94,7 +120,6 @@ function create_spdk_bdev_conf() {
)")
done
local IFS=","
jq -r '.' <<- JSON > $BASE_DIR/bdev.conf
{
"subsystems": [
@ -498,6 +523,8 @@ function usage() {
echo " It consists a single column of PCI addresses. SPDK Bdev names will be assigned"
echo " and Kernel block device names detected."
echo " Lines starting with # are ignored as comments."
echo " --bdev-io-cache-size Set IO cache size for for SPDK bdev subsystem."
echo " --bdev-io-pool-size Set IO pool size for for SPDK bdev subsystem."
echo " --max-disk=INT,ALL Number of disks to test on, this will run multiple workloads with increasing number of disk each run."
echo " If =ALL then test on all found disk. [default=$DISKNO]"
echo " --cpu-allowed=INT Comma-separated list of CPU cores used to run the workload. [default=$CPUS_ALLOWED]"
@ -531,6 +558,8 @@ while getopts 'h-:' optchar; do
exit 1
fi
;;
bdev-io-cache-size=*) BDEV_CACHE="${OPTARG#*=}" ;;
bdev-io-pool-size=*) BDEV_POOL="${OPTARG#*=}" ;;
max-disk=*) DISKNO="${OPTARG#*=}" ;;
cpu-allowed=*) CPUS_ALLOWED="${OPTARG#*=}" ;;
no-preconditioning) PRECONDITIONING=false ;;

View File

@ -37,7 +37,7 @@ BASE_DIR=$(readlink -f $(dirname $0))
trap 'rm -f *.state $BASE_DIR/bdev.conf; print_backtrace' ERR SIGTERM SIGABRT
if [[ "$PLUGIN" =~ "bdev" ]]; then
create_spdk_bdev_conf
create_spdk_bdev_conf "$BDEV_CACHE" "$BDEV_POOL"
fi
verify_disk_number
DISK_NAMES=$(get_disks $PLUGIN)