Remove duplicate code in l2arc_evict()
l2arc_evict() performs the adjustment of the size of buffers to be written on L2ARC unnecessarily. l2arc_write_size() is called right before l2arc_evict() and performs those adjustments. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #14828
This commit is contained in:
parent
cb549c7425
commit
d91778e31f
|
@ -8438,10 +8438,17 @@ l2arc_write_size(l2arc_dev_t *dev)
|
||||||
* iteration can occur.
|
* iteration can occur.
|
||||||
*/
|
*/
|
||||||
dev_size = dev->l2ad_end - dev->l2ad_start;
|
dev_size = dev->l2ad_end - dev->l2ad_start;
|
||||||
|
|
||||||
|
/* We need to add in the worst case scenario of log block overhead. */
|
||||||
tsize = size + l2arc_log_blk_overhead(size, dev);
|
tsize = size + l2arc_log_blk_overhead(size, dev);
|
||||||
if (dev->l2ad_vdev->vdev_has_trim && l2arc_trim_ahead > 0)
|
if (dev->l2ad_vdev->vdev_has_trim && l2arc_trim_ahead > 0) {
|
||||||
|
/*
|
||||||
|
* Trim ahead of the write size 64MB or (l2arc_trim_ahead/100)
|
||||||
|
* times the writesize, whichever is greater.
|
||||||
|
*/
|
||||||
tsize += MAX(64 * 1024 * 1024,
|
tsize += MAX(64 * 1024 * 1024,
|
||||||
(tsize * l2arc_trim_ahead) / 100);
|
(tsize * l2arc_trim_ahead) / 100);
|
||||||
|
}
|
||||||
|
|
||||||
if (tsize >= dev_size) {
|
if (tsize >= dev_size) {
|
||||||
cmn_err(CE_NOTE, "l2arc_write_max or l2arc_write_boost "
|
cmn_err(CE_NOTE, "l2arc_write_max or l2arc_write_boost "
|
||||||
|
@ -9074,19 +9081,6 @@ l2arc_evict(l2arc_dev_t *dev, uint64_t distance, boolean_t all)
|
||||||
|
|
||||||
buflist = &dev->l2ad_buflist;
|
buflist = &dev->l2ad_buflist;
|
||||||
|
|
||||||
/*
|
|
||||||
* We need to add in the worst case scenario of log block overhead.
|
|
||||||
*/
|
|
||||||
distance += l2arc_log_blk_overhead(distance, dev);
|
|
||||||
if (vd->vdev_has_trim && l2arc_trim_ahead > 0) {
|
|
||||||
/*
|
|
||||||
* Trim ahead of the write size 64MB or (l2arc_trim_ahead/100)
|
|
||||||
* times the write size, whichever is greater.
|
|
||||||
*/
|
|
||||||
distance += MAX(64 * 1024 * 1024,
|
|
||||||
(distance * l2arc_trim_ahead) / 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
top:
|
top:
|
||||||
rerun = B_FALSE;
|
rerun = B_FALSE;
|
||||||
if (dev->l2ad_hand >= (dev->l2ad_end - distance)) {
|
if (dev->l2ad_hand >= (dev->l2ad_end - distance)) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ typeset VDEV_MIN_MB=$((MINVDEVSIZE * 0.30 / 1024 / 1024))
|
||||||
log_must zpool create -f $TESTPOOL $TRIM_VDEV1 cache $TRIM_VDEV2
|
log_must zpool create -f $TESTPOOL $TRIM_VDEV1 cache $TRIM_VDEV2
|
||||||
verify_vdevs "-le" "$VDEV_MIN_MB" $TRIM_VDEV2
|
verify_vdevs "-le" "$VDEV_MIN_MB" $TRIM_VDEV2
|
||||||
|
|
||||||
typeset fill_mb=$(( floor(2 * MINVDEVSIZE) ))
|
typeset fill_mb=$(( floor(3 * MINVDEVSIZE) ))
|
||||||
export DIRECTORY=/$TESTPOOL
|
export DIRECTORY=/$TESTPOOL
|
||||||
export NUMJOBS=1
|
export NUMJOBS=1
|
||||||
export FILE_SIZE=${fill_mb}
|
export FILE_SIZE=${fill_mb}
|
||||||
|
|
Loading…
Reference in New Issue