Print this page
2882 implement libzfs_core
2883 changing "canmount" property to "on" should not always remount dataset
2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dsl_synctask.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_synctask.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright (c) 2012 by Delphix. All rights reserved.
  23   24   */
  24   25  
  25   26  #include <sys/dmu.h>
  26   27  #include <sys/dmu_tx.h>
  27   28  #include <sys/dsl_pool.h>
  28   29  #include <sys/dsl_dir.h>
  29   30  #include <sys/dsl_synctask.h>
  30   31  #include <sys/metaslab.h>
  31   32  
  32   33  #define DST_AVG_BLKSHIFT 14
↓ open down ↓ 45 lines elided ↑ open up ↑
  78   79          dsl_sync_task_t *dst;
  79   80  
  80   81  top:
  81   82          tx = dmu_tx_create_dd(dstg->dstg_pool->dp_mos_dir);
  82   83          VERIFY(0 == dmu_tx_assign(tx, TXG_WAIT));
  83   84  
  84   85          txg = dmu_tx_get_txg(tx);
  85   86  
  86   87          /* Do a preliminary error check. */
  87   88          dstg->dstg_err = 0;
       89 +#ifdef ZFS_DEBUG
       90 +        /*
       91 +         * Only check half the time, otherwise, the sync-context
       92 +         * check will almost never fail.
       93 +         */
       94 +        if (spa_get_random(2) == 0)
       95 +                goto skip;
       96 +#endif
  88   97          rw_enter(&dstg->dstg_pool->dp_config_rwlock, RW_READER);
  89   98          for (dst = list_head(&dstg->dstg_tasks); dst;
  90   99              dst = list_next(&dstg->dstg_tasks, dst)) {
  91      -#ifdef ZFS_DEBUG
  92      -                /*
  93      -                 * Only check half the time, otherwise, the sync-context
  94      -                 * check will almost never fail.
  95      -                 */
  96      -                if (spa_get_random(2) == 0)
  97      -                        continue;
  98      -#endif
  99  100                  dst->dst_err =
 100  101                      dst->dst_checkfunc(dst->dst_arg1, dst->dst_arg2, tx);
 101  102                  if (dst->dst_err)
 102  103                          dstg->dstg_err = dst->dst_err;
 103  104          }
 104  105          rw_exit(&dstg->dstg_pool->dp_config_rwlock);
 105  106  
 106  107          if (dstg->dstg_err) {
 107  108                  dmu_tx_commit(tx);
 108  109                  return (dstg->dstg_err);
 109  110          }
      111 +skip:
 110  112  
 111  113          /*
 112  114           * We don't generally have many sync tasks, so pay the price of
 113  115           * add_tail to get the tasks executed in the right order.
 114  116           */
 115  117          VERIFY(0 == txg_list_add_tail(&dstg->dstg_pool->dp_sync_tasks,
 116  118              dstg, txg));
 117  119  
 118  120          dmu_tx_commit(tx);
 119  121  
↓ open down ↓ 121 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX