1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

zfs: Avoid updating the L2ARC device header unnecessarily

From openzfs-master 0ae184a6b commit message:
  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.

Cherry-picked from openzfs 0ae184a6ba
Patch Author:   George Amanakis <gamanakis@gmail.com>

MFC after:	        3 days
Reviewed by:            delphij
Differential Revision:  https://reviews.freebsd.org/D28682
This commit is contained in:
Martin Matuska 2021-02-15 09:10:01 +01:00
parent f15e18a642
commit 5dce03847f

View File

@ -9062,6 +9062,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);
@ -9293,7 +9294,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);
}