Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions include/sys/arc.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,6 @@ boolean_t l2arc_range_check_overlap(uint64_t bottom, uint64_t top,
uint64_t check);
void l2arc_init(void);
void l2arc_fini(void);
void l2arc_start(void);
void l2arc_stop(void);
void l2arc_spa_rebuild_start(spa_t *spa);
void l2arc_spa_rebuild_stop(spa_t *spa);

Expand Down
34 changes: 34 additions & 0 deletions include/sys/arc_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,27 @@
extern "C" {
#endif

/*
* We can feed L2ARC from two states of ARC buffers, mru and mfu,
* and each of the state has two types: data and metadata.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state -> states

*/
#define L2ARC_FEED_TYPES 4

/*
* L2ARC state and statistics for persistent marker management.
*/
typedef struct l2arc_info {
arc_buf_hdr_t **l2arc_markers[L2ARC_FEED_TYPES];
uint64_t l2arc_total_writes; /* total writes for reset */
uint64_t l2arc_total_capacity; /* total L2ARC capacity */
uint64_t l2arc_smallest_capacity; /* smallest device capacity */
/*
* Per-device thread coordination for sublist processing
*/
boolean_t *l2arc_sublist_busy[L2ARC_FEED_TYPES];
kmutex_t l2arc_sublist_lock; /* protects busy flags */
} l2arc_info_t;

/*
* Note that buffers can be in one of 6 states:
* ARC_anon - anonymous (discussed below)
Expand Down Expand Up @@ -421,6 +442,19 @@ typedef struct l2arc_dev {
*/
zfs_refcount_t l2ad_lb_count;
boolean_t l2ad_trim_all; /* TRIM whole device */
/*
* DWPD tracking with daily reset
*/
uint64_t l2ad_dwpd_writes; /* 24h bytes written */
uint64_t l2ad_dwpd_start; /* 24h period start */
uint64_t l2ad_dwpd_accumulated; /* Accumulated */
/*
* Per-device feed thread for parallel L2ARC writes
*/
kthread_t *l2ad_feed_thread; /* feed thread handle */
boolean_t l2ad_thread_exit; /* signal thread exit */
kmutex_t l2ad_feed_thr_lock; /* thread sleep/wake */
kcondvar_t l2ad_feed_cv; /* thread wakeup cv */
} l2arc_dev_t;

/*
Expand Down
2 changes: 2 additions & 0 deletions include/sys/spa_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <sys/dsl_crypt.h>
#include <sys/zfeature.h>
#include <sys/zthr.h>
#include <sys/arc_impl.h>
#include <sys/dsl_deadlist.h>
#include <zfeature_common.h>

Expand Down Expand Up @@ -283,6 +284,7 @@ struct spa {
spa_aux_vdev_t spa_spares; /* hot spares */
spa_aux_vdev_t spa_l2cache; /* L2ARC cache devices */
boolean_t spa_aux_sync_uber; /* need to sync aux uber */
l2arc_info_t spa_l2arc_info; /* L2ARC state and stats */
nvlist_t *spa_label_features; /* Features for reading MOS */
uint64_t spa_config_object; /* MOS object for pool config */
uint64_t spa_config_generation; /* config generation number */
Expand Down
32 changes: 21 additions & 11 deletions man/man4/zfs.4
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ Seconds between L2ARC writing.
.
.It Sy l2arc_headroom Ns = Ns Sy 8 Pq u64
How far through the ARC lists to search for L2ARC cacheable content,
expressed as a multiplier of
.Sy l2arc_write_max .
expressed as a multiplier of the effective write size.
ARC persistence across reboots can be achieved with persistent L2ARC
by setting this parameter to
.Sy 0 ,
Expand All @@ -125,6 +124,19 @@ A value of
.Sy 100
disables this feature.
.
.It Sy l2arc_dwpd_limit Ns = Ns Sy 100 Pq uint
Drive Writes Per Day limit for L2ARC devices to protect SSD endurance,
specified as a percentage where 100 equals 1.0 DWPD.
A value of 100 means each L2ARC device can write its own capacity once per day.
Lower values support fractional DWPD
(50 = 0.5 DWPD, 30 = 0.3 DWPD for QLC SSDs).
Higher values allow more writes (300 = 3.0 DWPD).
The effective write rate is always bounded by
.Sy l2arc_write_max .
A value of 0 disables DWPD rate limiting entirely.
DWPD limiting only applies after the initial fill pass completes and when
total L2ARC capacity meets the persist threshold.
.
.It Sy l2arc_exclude_special Ns = Ns Sy 0 Ns | Ns 1 Pq int
Controls whether buffers present on special vdevs are eligible for caching
into L2ARC.
Expand Down Expand Up @@ -179,9 +191,8 @@ can render it slow or unusable.
This parameter limits L2ARC writes and rebuilds to achieve the target.
.
.It Sy l2arc_trim_ahead Ns = Ns Sy 0 Ns % Pq u64
Trims ahead of the current write size
.Pq Sy l2arc_write_max
on L2ARC devices by this percentage of write size if we have filled the device.
Trims ahead of the current write size on L2ARC devices by this percentage
of write size if we have filled the device.
If set to
.Sy 100
we TRIM twice the space required to accommodate upcoming writes.
Expand Down Expand Up @@ -216,13 +227,12 @@ to enable caching/reading prefetches to/from L2ARC.
.It Sy l2arc_norw Ns = Ns Sy 0 Ns | Ns 1 Pq int
No reads during writes.
.
.It Sy l2arc_write_boost Ns = Ns Sy 33554432 Ns B Po 32 MiB Pc Pq u64
Cold L2ARC devices will have
.Sy l2arc_write_max
increased by this amount while they remain cold.
.
.It Sy l2arc_write_max Ns = Ns Sy 33554432 Ns B Po 32 MiB Pc Pq u64
Max write bytes per interval.
Maximum write rate in bytes per second for each L2ARC device.
Used directly during initial fill, when DWPD limiting is disabled,
or for non-persistent L2ARC.
When DWPD limiting is active, writes are capped by this rate.
Total L2ARC throughput scales with the number of cache devices in a pool.
.
.It Sy l2arc_rebuild_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
Rebuild the L2ARC when importing a pool (persistent L2ARC).
Expand Down
Loading
Loading