Print this page
8115 parallel zfs mount


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved.
  25  * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  26  */
  27 
  28 #ifndef _LIBZFS_IMPL_H
  29 #define _LIBZFS_IMPL_H
  30 
  31 #include <sys/fs/zfs.h>
  32 #include <sys/spa.h>
  33 #include <sys/nvpair.h>
  34 #include <sys/dmu.h>
  35 #include <sys/zfs_ioctl.h>

  36 
  37 #include <libuutil.h>
  38 #include <libzfs.h>
  39 #include <libshare.h>
  40 #include <libzfs_core.h>
  41 
  42 #include <fm/libtopo.h>
  43 
  44 #ifdef  __cplusplus
  45 extern "C" {
  46 #endif
  47 
  48 #ifdef  VERIFY
  49 #undef  VERIFY
  50 #endif
  51 #define VERIFY  verify
  52 
  53 typedef struct libzfs_fru {
  54         char *zf_device;
  55         char *zf_fru;
  56         struct libzfs_fru *zf_chain;
  57         struct libzfs_fru *zf_next;
  58 } libzfs_fru_t;
  59 
  60 struct libzfs_handle {
  61         int libzfs_error;
  62         int libzfs_fd;
  63         FILE *libzfs_mnttab;
  64         FILE *libzfs_sharetab;
  65         zpool_handle_t *libzfs_pool_handles;
  66         uu_avl_pool_t *libzfs_ns_avlpool;
  67         uu_avl_t *libzfs_ns_avl;
  68         uint64_t libzfs_ns_gen;
  69         int libzfs_desc_active;
  70         char libzfs_action[1024];
  71         char libzfs_desc[1024];
  72         int libzfs_printerr;
  73         int libzfs_storeerr; /* stuff error messages into buffer */
  74         void *libzfs_sharehdl; /* libshare handle */
  75         boolean_t libzfs_mnttab_enable;







  76         avl_tree_t libzfs_mnttab_cache;
  77         int libzfs_pool_iter;
  78         topo_hdl_t *libzfs_topo_hdl;
  79         libzfs_fru_t **libzfs_fru_hash;
  80         libzfs_fru_t *libzfs_fru_list;
  81         char libzfs_chassis_id[256];
  82         boolean_t libzfs_prop_debug;
  83 };
  84 
  85 struct zfs_handle {
  86         libzfs_handle_t *zfs_hdl;
  87         zpool_handle_t *zpool_hdl;
  88         char zfs_name[ZFS_MAX_DATASET_NAME_LEN];
  89         zfs_type_t zfs_type; /* type including snapshot */
  90         zfs_type_t zfs_head_type; /* type excluding snapshot */
  91         dmu_objset_stats_t zfs_dmustats;
  92         nvlist_t *zfs_props;
  93         nvlist_t *zfs_user_props;
  94         nvlist_t *zfs_recvd_props;
  95         boolean_t zfs_mntcheck;




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved.
  25  * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
  26  */
  27 
  28 #ifndef _LIBZFS_IMPL_H
  29 #define _LIBZFS_IMPL_H
  30 
  31 #include <sys/fs/zfs.h>
  32 #include <sys/spa.h>
  33 #include <sys/nvpair.h>
  34 #include <sys/dmu.h>
  35 #include <sys/zfs_ioctl.h>
  36 #include <synch.h>
  37 
  38 #include <libuutil.h>
  39 #include <libzfs.h>
  40 #include <libshare.h>
  41 #include <libzfs_core.h>
  42 
  43 #include <fm/libtopo.h>
  44 
  45 #ifdef  __cplusplus
  46 extern "C" {
  47 #endif
  48 
  49 #ifdef  VERIFY
  50 #undef  VERIFY
  51 #endif
  52 #define VERIFY  verify
  53 
  54 typedef struct libzfs_fru {
  55         char *zf_device;
  56         char *zf_fru;
  57         struct libzfs_fru *zf_chain;
  58         struct libzfs_fru *zf_next;
  59 } libzfs_fru_t;
  60 
  61 struct libzfs_handle {
  62         int libzfs_error;
  63         int libzfs_fd;
  64         FILE *libzfs_mnttab;
  65         FILE *libzfs_sharetab;
  66         zpool_handle_t *libzfs_pool_handles;
  67         uu_avl_pool_t *libzfs_ns_avlpool;
  68         uu_avl_t *libzfs_ns_avl;
  69         uint64_t libzfs_ns_gen;
  70         int libzfs_desc_active;
  71         char libzfs_action[1024];
  72         char libzfs_desc[1024];
  73         int libzfs_printerr;
  74         int libzfs_storeerr; /* stuff error messages into buffer */
  75         void *libzfs_sharehdl; /* libshare handle */
  76         boolean_t libzfs_mnttab_enable;
  77         /*
  78          * We need a lock to handle the case where parallel mount threads
  79          * are populating the mnttab cache simultaneously. The lock only
  80          * protects the integrity of of the avl tree, and does not protect
  81          * the contents of the mnttab entries themselves.
  82          */
  83         mutex_t libzfs_mnttab_cache_lock;
  84         avl_tree_t libzfs_mnttab_cache;
  85         int libzfs_pool_iter;
  86         topo_hdl_t *libzfs_topo_hdl;
  87         libzfs_fru_t **libzfs_fru_hash;
  88         libzfs_fru_t *libzfs_fru_list;
  89         char libzfs_chassis_id[256];
  90         boolean_t libzfs_prop_debug;
  91 };
  92 
  93 struct zfs_handle {
  94         libzfs_handle_t *zfs_hdl;
  95         zpool_handle_t *zpool_hdl;
  96         char zfs_name[ZFS_MAX_DATASET_NAME_LEN];
  97         zfs_type_t zfs_type; /* type including snapshot */
  98         zfs_type_t zfs_head_type; /* type excluding snapshot */
  99         dmu_objset_stats_t zfs_dmustats;
 100         nvlist_t *zfs_props;
 101         nvlist_t *zfs_user_props;
 102         nvlist_t *zfs_recvd_props;
 103         boolean_t zfs_mntcheck;