Skip to content
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
28 changes: 28 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,13 @@ typedef struct l2arc_dev {
*/
zfs_refcount_t l2ad_lb_count;
boolean_t l2ad_trim_all; /* TRIM whole device */
/*
* 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
Loading