We use i as the iteration variable in the main test loop as well as some
internal loops. Due to this clash, $i variable of main test loops was
getting modified by the following loop in prep_mixed_mapping().
for ((i=0; i<num_blocks; i++)); do
If num_blocks is less than 10 (example ext4 with blocksize 4k and
cluster size 8k) i would always be set as 3 and the main loop would
never exit. Use local variable to fix this and while we are at it,
rename it for clarity.
Reported-by: Disha Goel <disgoel@linux.ibm.com>
Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
local operations=("W" "H" "U")
local num_blocks=$((awu_max / blksz))
- for ((i=0; i<num_blocks; i++)); do
+ local blkno
+ for ((blkno=0; blkno<num_blocks; blkno++)); do
local index=$((RANDOM % ${#operations[@]}))
local map="${operations[$index]}"
local mapping="${mapping}${map}"