aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Amanakis <[email protected]>2021-01-28 18:20:03 +0100
committerBrian Behlendorf <[email protected]>2021-01-28 11:39:24 -0800
commita1a13869654a038e8a64ae8583494b5d8af24fdd (patch)
treea7d6741290c93b2431af747ce36e706c6f84e582
parent43eaef6de817dab3e098488f8e02a11fe57944d0 (diff)
Avoid updating the L2ARC device header unnecessarily
If we do not write any buffers to the cache device and the evict hand has not advanced do not update the cache device header. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: George Amanakis <[email protected]> Closes #11522 Closes #11537
-rw-r--r--module/zfs/arc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index a6c293933..0e40d1fc5 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -8925,6 +8925,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
l2arc_write_callback_t *cb = NULL;
zio_t *pio, *wzio;
uint64_t guid = spa_load_guid(spa);
+ l2arc_dev_hdr_phys_t *l2dhdr = dev->l2ad_dev_hdr;
ASSERT3P(dev->l2ad_vdev, !=, NULL);
@@ -9153,7 +9154,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
* Although we did not write any buffers l2ad_evict may
* have advanced.
*/
- l2arc_dev_hdr_update(dev);
+ if (dev->l2ad_evict != l2dhdr->dh_evict)
+ l2arc_dev_hdr_update(dev);
return (0);
}