ZTS: default to random data in fill_fs

Update the fill_fs helper function to request a random fill pattern
when the "data" argument isn't specified.  This ensures the default
behavior is to perform a more realistic fill of incompressible blocks.

Additionally, update a few test cases to specify a random fill.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #17739
This commit is contained in:
Brian Behlendorf 2025-09-15 09:37:33 -07:00
parent 53c8d7071d
commit a4cb155e8d
4 changed files with 4 additions and 4 deletions

View File

@ -1085,7 +1085,7 @@ function fill_fs # destdir dirnum filenum bytes num_writes data
typeset -i filenum=${3:-50}
typeset -i bytes=${4:-8192}
typeset -i num_writes=${5:-10240}
typeset data=${6:-0}
typeset data=${6:-"R"}
mkdir -p $destdir/{1..$dirnum}
for f in $destdir/{1..$dirnum}/$TESTFILE{1..$filenum}; do

View File

@ -86,7 +86,7 @@ log_must zpool set autoreplace=on $TESTPOOL
# Add some data to the pool
log_must zfs create $TESTPOOL/fs
log_must fill_fs /$TESTPOOL/fs 4 100 4096 512 Z
log_must fill_fs /$TESTPOOL/fs 4 100 4096 512 R
log_must zpool export $TESTPOOL
# Record the partition UUID for later comparison

View File

@ -119,7 +119,7 @@ log_must zpool set autoreplace=on $TESTPOOL
# Add some data to the pool
log_must zfs create $TESTPOOL/fs
log_must fill_fs /$TESTPOOL/fs 4 100 4096 512 Z
log_must fill_fs /$TESTPOOL/fs 4 100 4096 512 R
log_must zpool export $TESTPOOL
# Record the partition UUID for later comparison

View File

@ -101,7 +101,7 @@ sync_pool $TESTPOOL
log_must zfs create $TESTPOOL/fs
MNTPOINT="$(get_prop mountpoint $TESTPOOL/fs)"
SECONDS=0
log_must fill_fs $MNTPOINT 1 200 4096 10 Z
log_must fill_fs $MNTPOINT 1 200 4096 10 R
log_note "fill_fs took $SECONDS seconds"
sync_pool $TESTPOOL