Print this page
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>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zfs/zfs_iter.c
          +++ new/usr/src/cmd/zfs/zfs_iter.c
↓ open down ↓ 87 lines elided ↑ open up ↑
  88   88   * Called for each dataset.  If the object is of an appropriate type,
  89   89   * add it to the avl tree and recurse over any children as necessary.
  90   90   */
  91   91  static int
  92   92  zfs_callback(zfs_handle_t *zhp, void *data)
  93   93  {
  94   94          callback_data_t *cb = data;
  95   95          boolean_t should_close = B_TRUE;
  96   96          boolean_t include_snaps = zfs_include_snapshots(zhp, cb);
  97   97          boolean_t include_bmarks = (cb->cb_types & ZFS_TYPE_BOOKMARK);
       98 +        boolean_t include_autosnaps =
       99 +            ((cb->cb_types & ZFS_TYPE_AUTOSNAP) &&
      100 +            !(cb->cb_flags & ZFS_ITER_PROP_LISTSNAPS));
  98  101  
  99  102          if ((zfs_get_type(zhp) & cb->cb_types) ||
 100  103              ((zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT) && include_snaps)) {
 101  104                  uu_avl_index_t idx;
 102  105                  zfs_node_t *node = safe_malloc(sizeof (zfs_node_t));
 103  106  
 104  107                  node->zn_handle = zhp;
 105  108                  uu_avl_node_init(node, &node->zn_avlnode, avl_pool);
 106  109                  if (uu_avl_find(cb->cb_avl, node, cb->cb_sortcol,
 107  110                      &idx) == NULL) {
↓ open down ↓ 21 lines elided ↑ open up ↑
 129  132          /*
 130  133           * Recurse if necessary.
 131  134           */
 132  135          if (cb->cb_flags & ZFS_ITER_RECURSE &&
 133  136              ((cb->cb_flags & ZFS_ITER_DEPTH_LIMIT) == 0 ||
 134  137              cb->cb_depth < cb->cb_depth_limit)) {
 135  138                  cb->cb_depth++;
 136  139                  if (zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM)
 137  140                          (void) zfs_iter_filesystems(zhp, zfs_callback, data);
 138  141                  if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT |
 139      -                    ZFS_TYPE_BOOKMARK)) == 0) && include_snaps)
 140      -                        (void) zfs_iter_snapshots(zhp,
 141      -                            (cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback,
 142      -                            data);
      142 +                    ZFS_TYPE_BOOKMARK | ZFS_TYPE_AUTOSNAP)) == 0)) {
      143 +                        if (include_snaps) {
      144 +                                (void) zfs_iter_snapshots(zhp,
      145 +                                    (cb->cb_flags & ZFS_ITER_SIMPLE) != 0,
      146 +                                    zfs_callback, data);
      147 +                        }
      148 +
      149 +                        if (include_autosnaps) {
      150 +                                (void) zfs_iter_autosnapshots(zhp,
      151 +                                    (cb->cb_flags & ZFS_ITER_SIMPLE) != 0,
      152 +                                    zfs_callback, data);
      153 +                        }
      154 +                }
      155 +
 143  156                  if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT |
 144  157                      ZFS_TYPE_BOOKMARK)) == 0) && include_bmarks)
 145  158                          (void) zfs_iter_bookmarks(zhp, zfs_callback, data);
 146  159                  cb->cb_depth--;
 147  160          }
 148  161  
 149  162          if (should_close)
 150  163                  zfs_close(zhp);
 151  164  
 152  165          return (0);
↓ open down ↓ 345 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX