mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
arc_read()/arc_access() refactoring and cleanup
ARC code was many times significantly modified over the years, that created significant amount of tangled and potentially broken code. This should make arc_access()/arc_read() code some more readable. - Decouple prefetch status tracking from b_refcnt. It made sense originally, but became highly cryptic over the years. Move all the logic into arc_access(). While there, clean up and comment state transitions in arc_access(). Some transitions were weird IMO. - Unify arc_access() calls to arc_read() instead of sometimes calling it from arc_read_done(). To avoid extra state changes and checks add one more b_refcnt for ARC_FLAG_IO_IN_PROGRESS. - Reimplement ARC_FLAG_WAIT in case of ARC_FLAG_IO_IN_PROGRESS with the same callback mechanism to not falsely account them as hits. Count those as "iohits", an intermediate between "hits" and "misses". While there, call read callbacks in original request order, that should be good for fairness and random speculations/allocations/aggregations. - Introduce additional statistic counters for prefetch, accounting predictive vs prescient and hits vs iohits vs misses. - Remove hash_lock argument from functions not needing it. - Remove ARC_FLAG_PREDICTIVE_PREFETCH, since it should be opposite to ARC_FLAG_PRESCIENT_PREFETCH if ARC_FLAG_PREFETCH is set. We may wish to add ARC_FLAG_PRESCIENT_PREFETCH to few more places. - Fix few false positive tests found in the process. Reviewed-by: George Wilson <gwilson@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #14123
This commit is contained in:
+1
@@ -163,6 +163,7 @@ before_clone=$(get_prop written $TESTPOOL/$TESTFS1)
|
||||
log_must zfs clone $TESTPOOL/$TESTFS1@snap1 $TESTPOOL/$TESTFS1/snap1.clone
|
||||
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS1/snap1.clone/testfile bs=1M \
|
||||
count=40
|
||||
sync_pool
|
||||
after_clone=$(get_prop written $TESTPOOL/$TESTFS1)
|
||||
within_percent $before_clone $after_clone 99.5 || \
|
||||
log_fail "unexpected written for clone $before_clone $after_clone"
|
||||
|
||||
@@ -80,7 +80,7 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
|
||||
log_must fio $FIO_SCRIPTS/random_reads.fio
|
||||
|
||||
log_must zpool export $TESTPOOL
|
||||
log_must zpool import -d $VDIR $TESTPOOL
|
||||
log_must zpool import -N -d $VDIR $TESTPOOL
|
||||
|
||||
# Regardless of l2arc_noprefetch, some MFU buffers might be evicted
|
||||
# from ARC, accessed later on as prefetches and transition to MRU as
|
||||
|
||||
@@ -95,6 +95,7 @@ for type in "" "mirror" "raidz2" "draid"; do
|
||||
|
||||
# Fill the pool, verify the vdevs are no longer sparse.
|
||||
file_write -o create -f /$TESTPOOL/file -b 1048576 -c $fill_mb -d R
|
||||
sync_pool $TESTPOOL
|
||||
verify_vdevs "-ge" "$VDEV_MAX_MB" $VDEVS
|
||||
|
||||
# Remove the file, wait for trim, verify the vdevs are now sparse.
|
||||
|
||||
@@ -94,6 +94,7 @@ for type in "" "mirror" "raidz2" "draid"; do
|
||||
|
||||
# Fill the pool, verify the vdevs are no longer sparse.
|
||||
file_write -o create -f /$TESTPOOL/file -b 1048576 -c $fill_mb -d R
|
||||
sync_pool $TESTPOOL
|
||||
verify_vdevs "-ge" "$VDEV_MAX_MB" $VDEVS
|
||||
|
||||
# Remove the file, issue trim, verify the vdevs are now sparse.
|
||||
|
||||
@@ -83,6 +83,7 @@ function do_test {
|
||||
|
||||
# Write to zvol
|
||||
log_must dd if=$datafile1 of=$zvolpath conv=fsync
|
||||
sync_pool
|
||||
|
||||
# Record how much space we've used (should be 5MB, with 128k
|
||||
# of tolerance).
|
||||
|
||||
Reference in New Issue
Block a user