Print this page
NEX-5736 implement autoreplace matching based on FRU slot number
NEX-6200 hot spares are not reactivated after reinserting into enclosure
NEX-9403 need to update FRU for spare and l2cache devices
NEX-9404 remove lofi autoreplace support from syseventd
NEX-9409 hotsparing doesn't work for vdevs without FRU
NEX-9424 zfs`vdev_online() needs better notification about state changes
Portions contributed by: Alek Pinchuk <alek@nexenta.com>
Portions contributed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-5728 Autosync Destination retention policy not being honoured
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-5795 Rename 'wrc' as 'wbc' in the source and in the tech docs
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
NEX-2846 Enable Automatic/Intelligent Hot Sparing capability
Reviewed by: Jeffry Molanus <jeffry.molanus@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
NEX-5163 backport illumos 6027 EOL zulu (XVR-4000)
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
6027 EOL zulu (XVR-4000)
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Peter Tribble <peter.tribble@gmail.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@omniti.com>
NEX-5162 backport illumos 6507 i386 makecontext(3c) needs to 16-byte align the stack
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
6507 i386 makecontext(3c) needs to 16-byte align the stack
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Dan McDonald <danmcd@omniti.com>
NEX-5207 attempt to activate spare cores fmd
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-4934 Add capability to remove special vdev
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
NEX-4830 writecache=off leaks data on special vdev (the data will never migrate)
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
6298 zfs_create_008_neg and zpool_create_023_neg need to be updated for large block support
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
2605 want to resume interrupted zfs send
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Xin Li <delphij@freebsd.org>
Reviewed by: Arne Jansen <sensille@gmx.net>
Approved by: Dan McDonald <danmcd@omniti.com>
5745 zfs set allows only one dataset property to be set at a time
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Reviewed by: Richard PALO <richard@NetBSD.org>
Reviewed by: Steven Hartland <killing@multiplay.co.uk>
Approved by: Rich Lowe <richlowe@richlowe.net>
5692 expose the number of hole blocks in a file
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
NEX-4476 WRC: Allow to use write back cache per tree of datasets
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
Revert "NEX-4476 WRC: Allow to use write back cache per tree of datasets"
This reverts commit fe97b74444278a6f36fec93179133641296312da.
NEX-4476 WRC: Allow to use write back cache per tree of datasets
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
NEX-3984 On-demand TRIM
Reviewed by: Alek Pinchuk <alek@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Conflicts:
        usr/src/common/zfs/zpool_prop.c
        usr/src/uts/common/sys/fs/zfs.h
NEX-3669 Faults for fans that don't exist
Reviewed by: Jeffry Molanus <jeffry.molanus@nexenta.com>
NEX-3891 Hide the snapshots that belong to in-kernel autosnap-service
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Alek Pinchuk <alek@nexenta.com>
NEX-3558 KRRP Integration
NEX-1456 Part 2, port FreeBSD patch - new zfs recv options support
OS-103 handle CoS descriptor persistent references across vdev operations
SUP-647 Long failover times dominated by zpool import times trigger client-side errors
re 13748 added zpool export -c option
zpool export -c command exports specified pool while keeping its latest
configuration in the cache file for subsequent zpool import -c.
re #10054 #13409 rb4387 added parallel unmount for zpool export
re #12585 rb4049 ZFS++ work port - refactoring to improve separation of open/closed code, bug fixes, performance improvements - open code
re #8279 rb3915 need a mechanism to notify NMS about ZFS config changes (Opened code)
Bug 11205: add missing libzfs_closed_stubs.c to fix opensource-only build.
ZFS plus work: special vdevs, cos, cos/vdev properties
Bug 10481 - Dry run option in 'zfs send' isn't the same as in NexentaStor 3.1
8853 sharenfs property must accept more than 1024 bytes

@@ -20,15 +20,15 @@
  */
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved.
- * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
- * Copyright 2016 Nexenta Systems, Inc.
+ * Copyright 2017 Nexenta Systems, Inc.
  * Copyright (c) 2017 Datto Inc.
  */
 
 #ifndef _LIBZFS_H
 #define _LIBZFS_H

@@ -49,11 +49,11 @@
 #endif
 
 /*
  * Miscellaneous ZFS constants
  */
-#define ZFS_MAXPROPLEN          MAXPATHLEN
+#define ZFS_MAXPROPLEN          (2 * MAXPATHLEN)
 #define ZPOOL_MAXPROPLEN        MAXPATHLEN
 
 /*
  * libzfs errors
  */

@@ -127,12 +127,20 @@
         EZFS_SCRUBBING,         /* currently scrubbing */
         EZFS_NO_SCRUB,          /* no active scrub */
         EZFS_DIFF,              /* general failure of zfs diff */
         EZFS_DIFFDATA,          /* bad zfs diff data */
         EZFS_POOLREADONLY,      /* pool is in read-only mode */
+        EZFS_PROPNOTSUP,        /* property not supported */
+        EZFS_COSNOTFOUND,       /* no matching CoS descriptor found */
+        EZFS_COSEXIST,          /* CoS descriptor already exists */
+        EZFS_COSREF,            /* CoS descriptor still referenced */
+        EZFS_WBCNOTSUP,         /* 'feature@wbc' is not enabled */
+        EZFS_WBCCHILD,          /* child ds has enabled WBC */
+        EZFS_WBCPARENT,         /* parent ds has enabled WBC */
+        EZFS_WBCALREADY,        /* WBC already enabled or disabled */
+        EZFS_WBCINPROGRESS,     /* WBC is disabling */
         EZFS_SCRUB_PAUSED,      /* scrub currently paused */
-        EZFS_NO_PENDING,        /* cannot cancel, no operation is pending */
         EZFS_UNKNOWN
 } zfs_error_t;
 
 /*
  * UEFI boot support parameters. When creating whole disk boot pool,

@@ -225,10 +233,11 @@
 extern const char *zpool_get_name(zpool_handle_t *);
 extern int zpool_get_state(zpool_handle_t *);
 extern const char *zpool_state_to_name(vdev_state_t, vdev_aux_t);
 extern const char *zpool_pool_state_to_name(pool_state_t);
 extern void zpool_free_handles(libzfs_handle_t *);
+extern int zpool_standard_error(libzfs_handle_t *, int, const char *);
 
 /*
  * Iterate over all active pools in the system.
  */
 typedef int (*zpool_iter_f)(zpool_handle_t *, void *);

@@ -253,10 +262,11 @@
 
 /*
  * Functions to manipulate pool and vdev state
  */
 extern int zpool_scan(zpool_handle_t *, pool_scan_func_t, pool_scrub_cmd_t);
+extern int zpool_trim(zpool_handle_t *, boolean_t start, uint64_t rate);
 extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *);
 extern int zpool_reguid(zpool_handle_t *);
 extern int zpool_reopen(zpool_handle_t *);
 
 extern int zpool_vdev_online(zpool_handle_t *, const char *, int,

@@ -264,29 +274,28 @@
 extern int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t);
 extern int zpool_vdev_attach(zpool_handle_t *, const char *,
     const char *, nvlist_t *, int);
 extern int zpool_vdev_detach(zpool_handle_t *, const char *);
 extern int zpool_vdev_remove(zpool_handle_t *, const char *);
-extern int zpool_vdev_remove_cancel(zpool_handle_t *);
-extern int zpool_vdev_indirect_size(zpool_handle_t *, const char *, uint64_t *);
 extern int zpool_vdev_split(zpool_handle_t *, char *, nvlist_t **, nvlist_t *,
     splitflags_t);
 
 extern int zpool_vdev_fault(zpool_handle_t *, uint64_t, vdev_aux_t);
 extern int zpool_vdev_degrade(zpool_handle_t *, uint64_t, vdev_aux_t);
 extern int zpool_vdev_clear(zpool_handle_t *, uint64_t);
 
 extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *,
-    boolean_t *, boolean_t *);
+    boolean_t *, boolean_t *, boolean_t *);
 extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *,
     boolean_t *, boolean_t *, boolean_t *);
 extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *,
     zpool_boot_label_t, uint64_t, int *);
 
 /*
  * Functions to manage pool properties
  */
+extern int zpool_set_proplist(zpool_handle_t *, nvlist_t *);
 extern int zpool_set_prop(zpool_handle_t *, const char *, const char *);
 extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *,
     size_t proplen, zprop_source_t *, boolean_t);
 extern uint64_t zpool_get_prop_int(zpool_handle_t *, zpool_prop_t,
     zprop_source_t *);

@@ -365,12 +374,12 @@
 extern boolean_t zpool_is_bootable(zpool_handle_t *);
 
 /*
  * Import and export functions
  */
-extern int zpool_export(zpool_handle_t *, boolean_t, const char *);
-extern int zpool_export_force(zpool_handle_t *, const char *);
+extern int zpool_export(zpool_handle_t *, boolean_t, boolean_t, const char *);
+extern int zpool_export_force(zpool_handle_t *, boolean_t, const char *);
 extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *,
     char *altroot);
 extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *,
     nvlist_t *, int);
 extern void zpool_print_unsup_feat(nvlist_t *config);

@@ -386,11 +395,10 @@
         uint64_t guid;          /* guid of a pool to find               */
         char *cachefile;        /* cachefile to use for import          */
         int can_be_active : 1;  /* can the pool be active?              */
         int unique : 1;         /* does 'poolname' already exist?       */
         int exists : 1;         /* set on return if pool already exists */
-        nvlist_t *policy;       /* rewind policy (rewind txg, etc.)     */
 } importargs_t;
 
 extern nvlist_t *zpool_search_import(libzfs_handle_t *, importargs_t *);
 
 /* legacy pool search routines */

@@ -409,10 +417,11 @@
     boolean_t verbose);
 extern int zpool_upgrade(zpool_handle_t *, uint64_t);
 extern int zpool_get_history(zpool_handle_t *, nvlist_t **);
 extern int zpool_history_unpack(char *, uint64_t, uint64_t *,
     nvlist_t ***, uint_t *);
+extern int zpool_stage_history(libzfs_handle_t *, const char *);
 extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *,
     size_t len);
 extern int zfs_ioctl(libzfs_handle_t *, int, struct zfs_cmd *);
 extern int zpool_get_physpath(zpool_handle_t *, char *, size_t);
 extern void zpool_explain_recover(libzfs_handle_t *, const char *, int,

@@ -508,10 +517,29 @@
 extern uint64_t zpool_prop_default_numeric(zpool_prop_t);
 extern const char *zpool_prop_column_name(zpool_prop_t);
 extern boolean_t zpool_prop_align_right(zpool_prop_t);
 
 /*
+ * Functions to manage vdev properties
+ */
+extern int vdev_set_proplist(zpool_handle_t *, const char *, nvlist_t *);
+extern int vdev_get_proplist(libzfs_handle_t *, char *, zprop_list_t **);
+extern int vdev_get_prop(zpool_handle_t *,  const char *, vdev_prop_t,
+    char *, size_t len);
+
+/*
+ * Functions to manage cos properties
+ */
+extern int cos_alloc(zpool_handle_t *, char *, nvlist_t *);
+extern int cos_free(zpool_handle_t *, char *, uint64_t, boolean_t);
+extern int cos_list(zpool_handle_t *, nvlist_t **);
+extern int cos_set_proplist(zpool_handle_t *, const char *, nvlist_t *);
+extern int cos_get_proplist(libzfs_handle_t *, char *, zprop_list_t **);
+extern int cos_get_prop(zpool_handle_t *,  const char *, cos_prop_t, char *,
+    size_t, nvlist_t **);
+
+/*
  * Functions shared by zfs and zpool property management.
  */
 extern int zprop_iter(zprop_func func, void *cb, boolean_t show_all,
     boolean_t ordered, zfs_type_t type);
 extern int zprop_get_list(libzfs_handle_t *, char *, zprop_list_t **,

@@ -544,19 +572,25 @@
 } zprop_get_cbdata_t;
 
 void zprop_print_one_property(const char *, zprop_get_cbdata_t *,
     const char *, const char *, zprop_source_t, const char *,
     const char *);
+void vdev_print_one_property(const char *, const char *,
+    zprop_get_cbdata_t *, const char *, const char *);
+void cos_print_one_property(const char *, const char *,
+    zprop_get_cbdata_t *, const char *, const char *);
 
 /*
  * Iterator functions.
  */
 typedef int (*zfs_iter_f)(zfs_handle_t *, void *);
 extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f, void *);
 extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *);
 extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
 extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *);
+extern int zfs_iter_autosnapshots(zfs_handle_t *, boolean_t, zfs_iter_f,
+    void *);
 extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
 extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *);
 extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *);
 extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *);
 

@@ -575,10 +609,12 @@
  * Functions to create and destroy datasets.
  */
 extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
     nvlist_t *);
 extern int zfs_create_ancestors(libzfs_handle_t *, const char *);
+extern int zfs_check_krrp(libzfs_handle_t *, const char *);
+extern int zfs_destroy_atomically(zfs_handle_t *, boolean_t);
 extern int zfs_destroy(zfs_handle_t *, boolean_t);
 extern int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t);
 extern int zfs_destroy_snaps_nvl(libzfs_handle_t *, nvlist_t *, boolean_t);
 extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
 extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *);

@@ -607,10 +643,13 @@
         boolean_t props;
 
         /* do not send (no-op, ie. -n) */
         boolean_t dryrun;
 
+        /* do not send (just calculate exact send stream size, ie. -s */
+        boolean_t sendsize;
+
         /* parsable verbose output (ie. -P) */
         boolean_t parsable;
 
         /* show progress (ie. -v) */
         boolean_t progress;

@@ -669,10 +708,13 @@
         boolean_t dryrun;
 
         /* rollback/destroy filesystems as necessary (eg, -F) */
         boolean_t force;
 
+        /* when force-receiving, do not destroy snapshots (ie, -K) */
+        boolean_t keepsnap;
+
         /* set "canmount=off" on all modified filesystems */
         boolean_t canmountoff;
 
         /*
          * Mark the file systems as "resumable" and do not destroy them if the

@@ -685,12 +727,12 @@
 
         /* do not mount file systems as they are extracted (private) */
         boolean_t nomount;
 } recvflags_t;
 
-extern int zfs_receive(libzfs_handle_t *, const char *, nvlist_t *,
-    recvflags_t *, int, avl_tree_t *);
+extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t *,
+    int, nvlist_t *, nvlist_t *, avl_tree_t *);
 
 typedef enum diff_flags {
         ZFS_DIFF_PARSEABLE = 0x1,
         ZFS_DIFF_TIMESTAMP = 0x2,
         ZFS_DIFF_CLASSIFY = 0x4

@@ -786,25 +828,29 @@
 /*
  * Enable and disable datasets within a pool by mounting/unmounting and
  * sharing/unsharing them.
  */
 extern int zpool_enable_datasets(zpool_handle_t *, const char *, int);
+extern int zpool_enable_datasets_ex(zpool_handle_t *, const char *, int, int);
 extern int zpool_disable_datasets(zpool_handle_t *, boolean_t);
+extern int zpool_disable_datasets_ex(zpool_handle_t *, boolean_t, int);
 
 /*
  * Mappings between vdev and FRU.
  */
 extern void libzfs_fru_refresh(libzfs_handle_t *);
 extern const char *libzfs_fru_lookup(libzfs_handle_t *, const char *);
 extern const char *libzfs_fru_devpath(libzfs_handle_t *, const char *);
+extern boolean_t libzfs_fru_cmp_enclosure(const char *a, const char *b);
+extern int libzfs_fru_cmp_slot(libzfs_handle_t *, const char *, const char *,
+    size_t);
 extern boolean_t libzfs_fru_compare(libzfs_handle_t *, const char *,
     const char *);
 extern boolean_t libzfs_fru_notself(libzfs_handle_t *, const char *);
 extern int zpool_fru_set(zpool_handle_t *, uint64_t, const char *);
 
 extern int zfs_get_hole_count(const char *, uint64_t *, uint64_t *);
-extern int zfs_remap_indirects(libzfs_handle_t *hdl, const char *);
 
 /* Allow consumers to initialize libshare externally for optimal performance */
 extern int zfs_init_libshare_arg(libzfs_handle_t *, int, void *);
 /*
  * For most consumers, zfs_init_libshare_arg is sufficient on its own, and