FreeBSD Bugzilla – Attachment 242680 Details for
Bug 271772
ZFS with L2ARC: panic: VERIFY3(dev->l2ad_hand <= dev->l2ad_evict) failed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
openzfs/zfs commit bcd5321 adapated for application to FreeBSD src
bcd5321039c3de29c14eac1068d392c15ad7fe2c-271772.patch (text/plain), 4.42 KB, created by
Graham Perrin
on 2023-06-08 06:32:18 UTC
(
hide
)
Description:
openzfs/zfs commit bcd5321 adapated for application to FreeBSD src
Filename:
MIME Type:
Creator:
Graham Perrin
Created:
2023-06-08 06:32:18 UTC
Size:
4.42 KB
patch
obsolete
>From bcd5321039c3de29c14eac1068d392c15ad7fe2c Mon Sep 17 00:00:00 2001 >From: George Amanakis <gamanakis@gmail.com> >Date: Tue, 6 Jun 2023 21:32:37 +0200 >Subject: [PATCH] Fix the L2ARC write size calculating logic > >l2arc_write_size() should return the write size after adjusting for trim >and overhead of the L2ARC log blocks. Also take into account the >allocated size of log blocks when deciding when to stop writing buffers >to L2ARC. > >https://bugs.freebsd.org/271772 > >PR: 271772 >Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> >Signed-off-by: George Amanakis <gamanakis@gmail.com> >Closes https://github.com/openzfs/zfs/pull/14939 >--- > module/zfs/arc.c | 45 +++++++++++++++++++++++++++++---------------- > 1 file changed, 29 insertions(+), 16 deletions(-) > >diff --git a/sys/contrib/openzfs/module/zfs/arc.c b/sys/contrib/openzfs/module/zfs/arc.c >index a78f664c4fe..6f68c29fc7f 100644 >--- a/sys/contrib/openzfs/module/zfs/arc.c >+++ b/sys/contrib/openzfs/module/zfs/arc.c >@@ -965,7 +965,7 @@ static void l2arc_hdr_restore(const l2arc_log_ent_phys_t *le, > l2arc_dev_t *dev); > > /* L2ARC persistence write I/O routines. */ >-static void l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, >+static uint64_t l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, > l2arc_write_callback_t *cb); > > /* L2ARC persistence auxiliary routines. */ >@@ -8175,7 +8175,7 @@ l2arc_write_eligible(uint64_t spa_guid, arc_buf_hdr_t *hdr) > static uint64_t > l2arc_write_size(l2arc_dev_t *dev) > { >- uint64_t size, dev_size, tsize; >+ uint64_t size; > > /* > * Make sure our globals have meaningful values in case the user >@@ -8192,35 +8192,40 @@ l2arc_write_size(l2arc_dev_t *dev) > if (arc_warm == B_FALSE) > size += l2arc_write_boost; > >- /* >- * Make sure the write size does not exceed the size of the cache >- * device. This is important in l2arc_evict(), otherwise infinite >- * iteration can occur. >- */ >- 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); >+ size += l2arc_log_blk_overhead(size, dev); > 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 * l2arc_trim_ahead) / 100); >+ size += MAX(64 * 1024 * 1024, >+ (size * l2arc_trim_ahead) / 100); > } > >- if (tsize >= dev_size) { >+ /* >+ * Make sure the write size does not exceed the size of the cache >+ * device. This is important in l2arc_evict(), otherwise infinite >+ * iteration can occur. >+ */ >+ if (size >= dev->l2ad_end - dev->l2ad_start) { > cmn_err(CE_NOTE, "l2arc_write_max or l2arc_write_boost " > "plus the overhead of log blocks (persistent L2ARC, " > "%llu bytes) exceeds the size of the cache device " > "(guid %llu), resetting them to the default (%d)", > (u_longlong_t)l2arc_log_blk_overhead(size, dev), > (u_longlong_t)dev->l2ad_vdev->vdev_guid, L2ARC_WRITE_SIZE); >+ > size = l2arc_write_max = l2arc_write_boost = L2ARC_WRITE_SIZE; > > if (arc_warm == B_FALSE) > size += l2arc_write_boost; >+ >+ size += l2arc_log_blk_overhead(size, dev); >+ if (dev->l2ad_vdev->vdev_has_trim && l2arc_trim_ahead > 0) { >+ size += MAX(64 * 1024 * 1024, >+ (size * l2arc_trim_ahead) / 100); >+ } > } > > return (size); >@@ -9413,8 +9418,14 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) > * arcstat_l2_{size,asize} kstats are updated > * internally. > */ >- if (l2arc_log_blk_insert(dev, hdr)) >- l2arc_log_blk_commit(dev, pio, cb); >+ if (l2arc_log_blk_insert(dev, hdr)) { >+ /* >+ * l2ad_hand has been accounted for in >+ * l2arc_log_blk_commit(). >+ */ >+ write_asize += >+ l2arc_log_blk_commit(dev, pio, cb); >+ } > > zio_nowait(wzio); > } >@@ -10564,7 +10575,7 @@ l2arc_dev_hdr_update(l2arc_dev_t *dev) > * This function allocates some memory to temporarily hold the serialized > * buffer to be written. This is then released in l2arc_write_done. > */ >-static void >+static uint64_t > l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, l2arc_write_callback_t *cb) > { > l2arc_log_blk_phys_t *lb = &dev->l2ad_log_blk; >@@ -10675,6 +10686,8 @@ l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, l2arc_write_callback_t *cb) > dev->l2ad_log_ent_idx = 0; > dev->l2ad_log_blk_payload_asize = 0; > dev->l2ad_log_blk_payload_start = 0; >+ >+ return (asize); > } > > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 271772
:
242680
|
242818