Print this page
NEX-16904 Need to port Illumos Bug #9433 to fix ARC hit rate
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-9752 backport illumos 6950 ARC should cache compressed data
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
6950 ARC should cache compressed data
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Don Brady <don.brady@intel.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
NEX-5058 WBC: Race between the purging of window and opening new one
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
NEX-2830 ZFS smart compression
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
6214 zpools going south
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
5987 zfs prefetch code needs work
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Gordon Ross <gordon.ross@nexenta.com>
NEX-4408 backport illumos #6214 to avoid corruption
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-3541 Implement persistent L2ARC
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Conflicts:
        usr/src/uts/common/fs/zfs/sys/spa.h
NEX-3558 KRRP Integration
NEX-3300 ddt byte count ceiling tunables should not depend on zfs_ddt_limit_type being set
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
NEX-3165 need some dedup improvements
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
 NEX-3165 segregate ddt in arc (other lint fix)
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
NEX-3165 segregate ddt in arc (lint fix)
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
NEX-3165 segregate ddt in arc
NEX-3079 port illumos ARC improvements
re #13989 port of illumos-3805
3805 arc shouldn't cache freed blocks
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Richard Elling <richard.elling@dey-sys.com>
Reviewed by: Will Andrews <will@firepipe.net>
Approved by: Dan McDonald <danmcd@nexenta.com>

@@ -20,10 +20,11 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  */
 
 #ifndef _SYS_ARC_H
 #define _SYS_ARC_H
 

@@ -31,10 +32,11 @@
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
+#include <sys/kreplication_common.h>
 #include <sys/zio.h>
 #include <sys/dmu.h>
 #include <sys/spa.h>
 
 /*

@@ -88,11 +90,19 @@
         /* Indicates that block was read with ASYNC priority. */
         ARC_FLAG_PRIO_ASYNC_READ        = 1 << 10,
         ARC_FLAG_L2_WRITING             = 1 << 11,      /* write in progress */
         ARC_FLAG_L2_EVICTED             = 1 << 12,      /* evicted during I/O */
         ARC_FLAG_L2_WRITE_HEAD          = 1 << 13,      /* head of write list */
-        /* indicates that the buffer contains metadata (otherwise, data) */
+
+        /*
+         * Below BUFC flags indicate that either the buffer contains
+         * metadata or DDT metadata. If both of these are not set then the
+         * buffer contains data.
+         * ARC_FLAG_BUFC_DDT is only used when zfs_arc_segregate_ddt is true.
+         * If this tunable is zero ARC_FLAG_BUFC_METADATA is used for both DDT
+         * and regular metadata.
+         */
         ARC_FLAG_BUFC_METADATA          = 1 << 14,
 
         /* Flags specifying whether optional hdr struct fields are defined */
         ARC_FLAG_HAS_L1HDR              = 1 << 15,
         ARC_FLAG_HAS_L2HDR              = 1 << 16,

@@ -103,10 +113,12 @@
          * the data without having to store the checksum in the hdr.
          */
         ARC_FLAG_COMPRESSED_ARC         = 1 << 17,
         ARC_FLAG_SHARED_DATA            = 1 << 18,
 
+        ARC_FLAG_BUFC_DDT               = 1 << 19,      /* DDT buf */
+
         /*
          * The arc buffer's compression mode is stored in the top 7 bits of the
          * flags field, so these dummy flags are included so that MDB can
          * interpret the enum properly.
          */

@@ -115,11 +127,10 @@
         ARC_FLAG_COMPRESS_2             = 1 << 26,
         ARC_FLAG_COMPRESS_3             = 1 << 27,
         ARC_FLAG_COMPRESS_4             = 1 << 28,
         ARC_FLAG_COMPRESS_5             = 1 << 29,
         ARC_FLAG_COMPRESS_6             = 1 << 30
-
 } arc_flags_t;
 
 typedef enum arc_buf_flags {
         ARC_BUF_FLAG_SHARED             = 1 << 0,
         ARC_BUF_FLAG_COMPRESSED         = 1 << 1

@@ -135,25 +146,39 @@
 
 typedef enum arc_buf_contents {
         ARC_BUFC_INVALID,                       /* invalid type */
         ARC_BUFC_DATA,                          /* buffer contains data */
         ARC_BUFC_METADATA,                      /* buffer contains metadata */
+        ARC_BUFC_DDT,                           /* buffer contains ddt */
         ARC_BUFC_NUMTYPES
 } arc_buf_contents_t;
 
 /*
  * The following breakdows of arc_size exist for kstat only.
  */
 typedef enum arc_space_type {
         ARC_SPACE_DATA,
         ARC_SPACE_META,
+        ARC_SPACE_DDT,
         ARC_SPACE_HDRS,
         ARC_SPACE_L2HDRS,
         ARC_SPACE_OTHER,
         ARC_SPACE_NUMTYPES
 } arc_space_type_t;
 
+/* see spa_misc.c and zio_ddt_write() */
+extern uint64_t zfs_ddt_byte_ceiling;
+typedef enum zfs_ddt_limit {
+        DDT_NO_LIMIT = 0,
+        DDT_LIMIT_TO_ARC = 1,
+        DDT_LIMIT_TO_L2ARC = 2,
+} zfs_ddt_limit_t;
+extern zfs_ddt_limit_t zfs_ddt_limit_type;
+extern boolean_t zfs_arc_segregate_ddt;
+extern uint64_t const * arc_ddt_evict_threshold;
+
+
 void arc_space_consume(uint64_t space, arc_space_type_t type);
 void arc_space_return(uint64_t space, arc_space_type_t type);
 boolean_t arc_is_metadata(arc_buf_t *buf);
 enum zio_compress arc_get_compression(arc_buf_t *buf);
 int arc_decompress(arc_buf_t *buf);

@@ -167,27 +192,30 @@
 void arc_return_buf(arc_buf_t *buf, void *tag);
 void arc_loan_inuse_buf(arc_buf_t *buf, void *tag);
 void arc_buf_destroy(arc_buf_t *buf, void *tag);
 int arc_buf_size(arc_buf_t *buf);
 int arc_buf_lsize(arc_buf_t *buf);
+void arc_buf_access(arc_buf_t *buf);
 void arc_release(arc_buf_t *buf, void *tag);
 int arc_released(arc_buf_t *buf);
 void arc_buf_freeze(arc_buf_t *buf);
 void arc_buf_thaw(arc_buf_t *buf);
 #ifdef ZFS_DEBUG
 int arc_referenced(arc_buf_t *buf);
 #endif
 
+int arc_io_bypass(spa_t *spa, const blkptr_t *bp,
+    arc_bypass_io_func func, void *arg);
 int arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp,
     arc_done_func_t *done, void *private, zio_priority_t priority, int flags,
     arc_flags_t *arc_flags, const zbookmark_phys_t *zb);
 zio_t *arc_write(zio_t *pio, spa_t *spa, uint64_t txg,
     blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp,
     arc_done_func_t *ready, arc_done_func_t *child_ready,
     arc_done_func_t *physdone, arc_done_func_t *done,
     void *private, zio_priority_t priority, int zio_flags,
-    const zbookmark_phys_t *zb);
+    const zbookmark_phys_t *zb, const zio_smartcomp_info_t *smartcomp);
 void arc_freed(spa_t *spa, const blkptr_t *bp);
 
 void arc_flush(spa_t *spa, boolean_t retry);
 void arc_tempreserve_clear(uint64_t reserve);
 int arc_tempreserve_space(uint64_t reserve, uint64_t txg);

@@ -198,17 +226,18 @@
 
 /*
  * Level 2 ARC
  */
 
-void l2arc_add_vdev(spa_t *spa, vdev_t *vd);
+void l2arc_add_vdev(spa_t *spa, vdev_t *vd, boolean_t rebuild);
 void l2arc_remove_vdev(vdev_t *vd);
 boolean_t l2arc_vdev_present(vdev_t *vd);
 void l2arc_init(void);
 void l2arc_fini(void);
 void l2arc_start(void);
 void l2arc_stop(void);
+void l2arc_spa_rebuild_start(spa_t *spa);
 
 #ifndef _KERNEL
 extern boolean_t arc_watch;
 extern int arc_procfd;
 #endif