Skip to content

Commit 9a63986

Browse files
committed
common/null_blk: Log null_blk configuration parameters
Make test scripts easier to debug by logging the null_blk configuration parameters. No functionality has been changed. Signed-off-by: Bart Van Assche <[email protected]>
1 parent 16dde5a commit 9a63986

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

common/null_blk

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ _init_null_blk() {
4949

5050
# Configure one null_blk instance with name $1 and parameters $2..${$#}.
5151
_configure_null_blk() {
52-
local nullb_path=/sys/kernel/config/nullb/$1 param val
52+
local nullb_path=/sys/kernel/config/nullb/$1 params param
5353
shift
5454

5555
if [[ ! -d /sys/module/null_blk ]]; then
@@ -58,15 +58,17 @@ _configure_null_blk() {
5858

5959
mkdir "$nullb_path" || return $?
6060

61+
params=()
6162
if (( RUN_FOR_ZONED )); then
62-
echo "1" > "$nullb_path/zoned" || return 1
63+
params+=(zoned=1)
6364
fi
65+
params+=("$@")
6466

65-
while [[ $# -gt 0 ]]; do
66-
param="${1%%=*}"
67-
val="${1#*=}"
68-
shift
69-
echo "$val" > "$nullb_path/$param" || return 1
67+
echo "$nullb_path ${params[*]}" >>"${FULL}"
68+
69+
for param in "${params[@]}"; do
70+
local key="${param%%=*}" val="${param#*=}"
71+
echo "$val" > "$nullb_path/$key" || return 1
7072
done
7173
}
7274

0 commit comments

Comments
 (0)