tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ZFS L2ARC on NetBSD-9



Hi,

While trying to setup an L2ARC on my amd64 Xen dom0, I noticed that almost no
data was feeding in to the cache.  The counters in kstat.zfs.misc.arcstats.l2*
indicate the l2arc feed process must be stuck somewhere.  I think I've traced
the problem to l2arc_write_interval() called by l2arc_feed_thread(). It looks
like the l2arc_feed_thread() loop only runs once because the delay set by
l2arc_write_interval() is always too large.  Maybe this is a difference between
NetBSD and Solaris cv_timedwait?  Something like this results in a functioning
L2ARC on my system:

--- a/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c
@@ -6520,7 +6520,7 @@ l2arc_write_size(void)
 static clock_t
 l2arc_write_interval(clock_t began, uint64_t wanted, uint64_t wrote)
 {
-       clock_t interval, next, now;
+       clock_t interval;
 
        /*
         * If the ARC lists are busy, increase our write rate; if the
@@ -6529,14 +6529,11 @@ l2arc_write_interval(clock_t began, uint64_t wanted, 
uint64_t wrote)
         * what we wanted, schedule the next write much sooner.
         */
        if (l2arc_feed_again && wrote > (wanted / 2))
-               interval = (hz * l2arc_feed_min_ms) / 1000;
+               interval = mstohz(l2arc_feed_min_ms) / 2;
        else
-               interval = hz * l2arc_feed_secs;
+               interval = mstohz(l2arc_feed_secs);
 
-       now = ddi_get_lbolt();
-       next = MAX(now, MIN(now + interval, began + interval));
-
-       return (next);
+       return (interval);
 }
 
This is on NetBSD-9.  I hope I haven't missed something obvious in setup here.  
Does anyone else have a working L2ARC?

Thanks,
Andrew


Home | Main Index | Thread Index | Old Index