mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	ZTS: remove get_arcstat
It's now a simple wrapper, so lets just call kstat direct. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tony Hutter <hutter2@llnl.gov>
This commit is contained in:
		
							parent
							
								
									6edbbe0646
								
							
						
					
					
						commit
						cf55fdea24
					
				| @ -3664,23 +3664,6 @@ function ls_xattr # path | ||||
| 	esac | ||||
| } | ||||
| 
 | ||||
| function get_arcstat # stat | ||||
| { | ||||
| 	typeset stat=$1 | ||||
| 
 | ||||
| 	case "$UNAME" in | ||||
| 	FreeBSD) | ||||
| 		kstat arcstats.$stat | ||||
| 		;; | ||||
| 	Linux) | ||||
| 		kstat arcstats | awk "/$stat/"' { print $3 }' | ||||
| 		;; | ||||
| 	*) | ||||
| 		false | ||||
| 		;; | ||||
| 	esac | ||||
| } | ||||
| 
 | ||||
| function punch_hole # offset length file | ||||
| { | ||||
| 	typeset offset=$1 | ||||
| @ -3732,9 +3715,9 @@ function arcstat_quiescence # stat echo | ||||
| 	fi | ||||
| 
 | ||||
| 	while $do_once || [ $stat1 -ne $stat2 ] || [ $stat2 -eq 0 ]; do | ||||
| 		typeset stat1=$(get_arcstat $stat) | ||||
| 		typeset stat1=$(kstat arcstats.$stat) | ||||
| 		sleep 0.5 | ||||
| 		typeset stat2=$(get_arcstat $stat) | ||||
| 		typeset stat2=$(kstat arcstats.$stat) | ||||
| 		do_once=false | ||||
| 	done | ||||
| 
 | ||||
|  | ||||
| @ -96,9 +96,9 @@ export RUNTIME=1 | ||||
| 
 | ||||
| typeset do_once=true | ||||
| while $do_once || [[ $l2_size1 -le $l2_size2 ]]; do | ||||
| 	typeset l2_size1=$(get_arcstat l2_size) | ||||
| 	typeset l2_size1=$(kstat arcstats.l2_size) | ||||
| 	log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| 	typeset l2_size2=$(get_arcstat l2_size) | ||||
| 	typeset l2_size2=$(kstat arcstats.l2_size) | ||||
| 	do_once=false | ||||
| done | ||||
| 
 | ||||
|  | ||||
| @ -83,12 +83,12 @@ log_must truncate -s ${cache_sz}M $VDEV_CACHE | ||||
| 
 | ||||
| log_must zpool create -O compression=lz4 -f $TESTPOOL-l2arc $VDEV cache $VDEV_CACHE | ||||
| 
 | ||||
| l2_cksum_bad_start=$(get_arcstat l2_cksum_bad) | ||||
| l2_cksum_bad_start=$(kstat arcstats.l2_cksum_bad) | ||||
| 
 | ||||
| log_must fio $FIO_SCRIPTS/mkfiles.fio | ||||
| log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| 
 | ||||
| l2_cksum_bad_end=$(get_arcstat l2_cksum_bad) | ||||
| l2_cksum_bad_end=$(kstat arcstats.l2_cksum_bad) | ||||
| 
 | ||||
| log_note "L2ARC Failed Checksums before: $l2_cksum_bad_start After:"\ | ||||
| 	"$l2_cksum_bad_end" | ||||
|  | ||||
| @ -83,12 +83,12 @@ log_must truncate -s ${cache_sz}M $VDEV_CACHE | ||||
| 
 | ||||
| log_must zpool create -O compression=lz4 -f $TESTPOOL-l2arc $VDEV cache $VDEV_CACHE | ||||
| 
 | ||||
| l2_cksum_bad_start=$(get_arcstat l2_cksum_bad) | ||||
| l2_cksum_bad_start=$(kstat arcstats.l2_cksum_bad) | ||||
| 
 | ||||
| log_must fio $FIO_SCRIPTS/mkfiles.fio | ||||
| log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| 
 | ||||
| l2_cksum_bad_end=$(get_arcstat l2_cksum_bad) | ||||
| l2_cksum_bad_end=$(kstat arcstats.l2_cksum_bad) | ||||
| 
 | ||||
| log_note "L2ARC Failed Checksums before: $l2_cksum_bad_start After:"\ | ||||
| 	"$l2_cksum_bad_end" | ||||
|  | ||||
| @ -88,12 +88,12 @@ log_must eval "echo $PASSPHRASE | zfs create -o compression=zstd " \ | ||||
| 	"-o encryption=on -o keyformat=passphrase -o keylocation=prompt " \ | ||||
| 	"$TESTPOOL-l2arc/encrypted" | ||||
| 
 | ||||
| l2_cksum_bad_start=$(get_arcstat l2_cksum_bad) | ||||
| l2_cksum_bad_start=$(kstat arcstats.l2_cksum_bad) | ||||
| 
 | ||||
| log_must fio $FIO_SCRIPTS/mkfiles.fio | ||||
| log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| 
 | ||||
| l2_cksum_bad_end=$(get_arcstat l2_cksum_bad) | ||||
| l2_cksum_bad_end=$(kstat arcstats.l2_cksum_bad) | ||||
| 
 | ||||
| log_note "L2ARC Failed Checksums before: $l2_cksum_bad_start After:"\ | ||||
| 	"$l2_cksum_bad_end" | ||||
|  | ||||
| @ -88,12 +88,12 @@ log_must eval "echo $PASSPHRASE | zfs create -o compression=zstd " \ | ||||
| 	"-o encryption=on -o keyformat=passphrase -o keylocation=prompt " \ | ||||
| 	"$TESTPOOL-l2arc/encrypted" | ||||
| 
 | ||||
| l2_cksum_bad_start=$(get_arcstat l2_cksum_bad) | ||||
| l2_cksum_bad_start=$(kstat arcstats.l2_cksum_bad) | ||||
| 
 | ||||
| log_must fio $FIO_SCRIPTS/mkfiles.fio | ||||
| log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| 
 | ||||
| l2_cksum_bad_end=$(get_arcstat l2_cksum_bad) | ||||
| l2_cksum_bad_end=$(kstat arcstats.l2_cksum_bad) | ||||
| 
 | ||||
| log_note "L2ARC Failed Checksums before: $l2_cksum_bad_start After:"\ | ||||
| 	"$l2_cksum_bad_end" | ||||
|  | ||||
| @ -73,18 +73,18 @@ arcstat_quiescence_noecho l2_size | ||||
| log_must zpool offline $TESTPOOL $VDEV_CACHE | ||||
| arcstat_quiescence_noecho l2_size | ||||
| 
 | ||||
| typeset l2_mfu_init=$(get_arcstat l2_mfu_asize) | ||||
| typeset l2_mru_init=$(get_arcstat l2_mru_asize) | ||||
| typeset l2_prefetch_init=$(get_arcstat l2_prefetch_asize) | ||||
| typeset l2_asize_init=$(get_arcstat l2_asize) | ||||
| typeset l2_mfu_init=$(kstat arcstats.l2_mfu_asize) | ||||
| typeset l2_mru_init=$(kstat arcstats.l2_mru_asize) | ||||
| typeset l2_prefetch_init=$(kstat arcstats.l2_prefetch_asize) | ||||
| typeset l2_asize_init=$(kstat arcstats.l2_asize) | ||||
| 
 | ||||
| log_must zpool online $TESTPOOL $VDEV_CACHE | ||||
| arcstat_quiescence_noecho l2_size | ||||
| log_must zpool export $TESTPOOL | ||||
| arcstat_quiescence_noecho l2_feeds | ||||
| 
 | ||||
| log_must test $(get_arcstat l2_mfu_asize) -eq 0 | ||||
| log_must test $(get_arcstat l2_mru_asize) -eq 0 | ||||
| log_must test $(kstat arcstats.l2_mfu_asize) -eq 0 | ||||
| log_must test $(kstat arcstats.l2_mru_asize) -eq 0 | ||||
| log_must zpool import -d $VDIR $TESTPOOL | ||||
| arcstat_quiescence_noecho l2_size | ||||
| 
 | ||||
| @ -93,10 +93,10 @@ arcstat_quiescence_noecho l2_size | ||||
| log_must zpool offline $TESTPOOL $VDEV_CACHE | ||||
| arcstat_quiescence_noecho l2_size | ||||
| 
 | ||||
| typeset l2_mfu_end=$(get_arcstat l2_mfu_asize) | ||||
| typeset l2_mru_end=$(get_arcstat l2_mru_asize) | ||||
| typeset l2_prefetch_end=$(get_arcstat l2_prefetch_asize) | ||||
| typeset l2_asize_end=$(get_arcstat l2_asize) | ||||
| typeset l2_mfu_end=$(kstat arcstats.l2_mfu_asize) | ||||
| typeset l2_mru_end=$(kstat arcstats.l2_mru_asize) | ||||
| typeset l2_prefetch_end=$(kstat arcstats.l2_prefetch_asize) | ||||
| typeset l2_asize_end=$(kstat arcstats.l2_asize) | ||||
| 
 | ||||
| log_must test $(( $l2_mru_end + $l2_mfu_end + $l2_prefetch_end - \ | ||||
| 	$l2_asize_end )) -eq 0 | ||||
|  | ||||
| @ -71,10 +71,10 @@ log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| log_must zpool export $TESTPOOL1 | ||||
| log_must zpool import $TESTPOOL1 -d $VDEV1 | ||||
| 
 | ||||
| typeset starting_miss_count=$(get_arcstat l2_misses) | ||||
| typeset starting_miss_count=$(kstat arcstats.l2_misses) | ||||
| 
 | ||||
| log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| log_must test $(get_arcstat l2_misses) -eq $starting_miss_count | ||||
| log_must test $(kstat arcstats.l2_misses) -eq $starting_miss_count | ||||
| 
 | ||||
| # I/O to pool with l2arc - expect that l2_misses rises | ||||
| export DIRECTORY=/$TESTPOOL | ||||
| @ -88,7 +88,7 @@ log_must zpool export $TESTPOOL | ||||
| log_must zpool import $TESTPOOL -d $VDEV | ||||
| 
 | ||||
| log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| log_must test $(get_arcstat l2_misses) -gt $starting_miss_count | ||||
| log_must test $(kstat arcstats.l2_misses) -gt $starting_miss_count | ||||
| 
 | ||||
| log_must zpool destroy -f $TESTPOOL | ||||
| log_must zpool destroy -f $TESTPOOL1 | ||||
|  | ||||
| @ -72,7 +72,7 @@ export FILE_SIZE=$(( floor($fill_mb / $NUMJOBS) ))M | ||||
| 
 | ||||
| log_must truncate -s ${cache_sz}M $VDEV_CACHE | ||||
| 
 | ||||
| typeset log_blk_start=$(get_arcstat l2_log_blk_writes) | ||||
| typeset log_blk_start=$(kstat arcstats.l2_log_blk_writes) | ||||
| 
 | ||||
| log_must zpool create -f $TESTPOOL $VDEV cache $VDEV_CACHE | ||||
| 
 | ||||
| @ -89,7 +89,7 @@ log_must zpool import -N -d $VDIR $TESTPOOL | ||||
| # will not be 0 (mentioned also in zfs.4) | ||||
| # For the purposes of this test we mitigate this by disabling (predictive) | ||||
| # ZFS prefetches with zfs_prefetch_disable=1. | ||||
| log_must test $(get_arcstat l2_mru_asize) -eq 0 | ||||
| log_must test $(kstat arcstats.l2_mru_asize) -eq 0 | ||||
| 
 | ||||
| log_must zpool destroy -f $TESTPOOL | ||||
| 
 | ||||
|  | ||||
| @ -88,7 +88,7 @@ arcstat_quiescence_noecho l2_feeds | ||||
| 
 | ||||
| typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | awk '/log_blk_count/ {print $2}') | ||||
| 
 | ||||
| typeset l2_rebuild_log_blk_start=$(get_arcstat l2_rebuild_log_blks) | ||||
| typeset l2_rebuild_log_blk_start=$(kstat arcstats.l2_rebuild_log_blks) | ||||
| 
 | ||||
| log_must zpool import -d $VDIR $TESTPOOL | ||||
| arcstat_quiescence_noecho l2_size | ||||
|  | ||||
| @ -94,7 +94,7 @@ arcstat_quiescence_noecho l2_feeds | ||||
| 
 | ||||
| typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | awk '/log_blk_count/ {print $2}') | ||||
| 
 | ||||
| typeset l2_rebuild_log_blk_start=$(get_arcstat l2_rebuild_log_blks) | ||||
| typeset l2_rebuild_log_blk_start=$(kstat arcstats.l2_rebuild_log_blks) | ||||
| 
 | ||||
| log_must zpool import -d $VDIR $TESTPOOL | ||||
| log_must eval "echo $PASSPHRASE | zfs mount -l $TESTPOOL/$TESTFS1" | ||||
|  | ||||
| @ -73,12 +73,12 @@ log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| 
 | ||||
| log_must zpool export $TESTPOOL | ||||
| 
 | ||||
| typeset l2_success_start=$(get_arcstat l2_rebuild_success) | ||||
| typeset l2_success_start=$(kstat arcstats.l2_rebuild_success) | ||||
| 
 | ||||
| log_must zpool import -d $VDIR $TESTPOOL | ||||
| log_mustnot test "$(zpool iostat -Hpv $TESTPOOL $VDEV_CACHE | awk '{print $2}')" -gt 80000000 | ||||
| 
 | ||||
| typeset l2_success_end=$(get_arcstat l2_rebuild_success) | ||||
| typeset l2_success_end=$(kstat arcstats.l2_rebuild_success) | ||||
| 
 | ||||
| log_mustnot test $l2_success_end -gt $l2_success_start | ||||
| 
 | ||||
|  | ||||
| @ -79,7 +79,7 @@ arcstat_quiescence_noecho l2_size | ||||
| log_must zpool export $TESTPOOL | ||||
| arcstat_quiescence_noecho l2_feeds | ||||
| 
 | ||||
| typeset l2_rebuild_log_blk_start=$(get_arcstat l2_rebuild_log_blks) | ||||
| typeset l2_rebuild_log_blk_start=$(kstat arcstats.l2_rebuild_log_blks) | ||||
| typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | awk '/log_blk_count/ {print $2}') | ||||
| 
 | ||||
| log_must zpool import -d $VDIR $TESTPOOL | ||||
|  | ||||
| @ -76,7 +76,7 @@ arcstat_quiescence_noecho l2_size | ||||
| log_must zpool offline $TESTPOOL $VDEV_CACHE | ||||
| arcstat_quiescence_noecho l2_size | ||||
| 
 | ||||
| typeset l2_rebuild_log_blk_start=$(get_arcstat l2_rebuild_log_blks) | ||||
| typeset l2_rebuild_log_blk_start=$(kstat arcstats.l2_rebuild_log_blks) | ||||
| typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | awk '/log_blk_count/ {print $2}') | ||||
| 
 | ||||
| log_must zpool online $TESTPOOL $VDEV_CACHE | ||||
|  | ||||
| @ -89,9 +89,9 @@ log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| export RUNTIME=1 | ||||
| typeset do_once=true | ||||
| while $do_once || [[ $l2_size1 -le $l2_size2 ]]; do | ||||
| 	typeset l2_size1=$(get_arcstat l2_size) | ||||
| 	typeset l2_size1=$(kstat arcstats.l2_size) | ||||
| 	log_must fio $FIO_SCRIPTS/random_reads.fio | ||||
| 	typeset l2_size2=$(get_arcstat l2_size) | ||||
| 	typeset l2_size2=$(kstat arcstats.l2_size) | ||||
| 	do_once=false | ||||
| done | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Rob Norris
						Rob Norris