Print this page
OS-1566 dataset quota for ZFS datasets

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/sys/dsl_dir.h
          +++ new/usr/src/uts/common/fs/zfs/sys/dsl_dir.h
↓ 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, Joyent, Inc. All rights reserved.
  23   24   */
  24   25  
  25   26  #ifndef _SYS_DSL_DIR_H
  26   27  #define _SYS_DSL_DIR_H
  27   28  
  28   29  #include <sys/dmu.h>
  29   30  #include <sys/dsl_pool.h>
  30   31  #include <sys/dsl_synctask.h>
  31   32  #include <sys/refcount.h>
  32   33  #include <sys/zfs_context.h>
↓ open down ↓ 30 lines elided ↑ open up ↑
  63   64          uint64_t dd_uncompressed_bytes;
  64   65          /* Administrative quota setting */
  65   66          uint64_t dd_quota;
  66   67          /* Administrative reservation setting */
  67   68          uint64_t dd_reserved;
  68   69          uint64_t dd_props_zapobj;
  69   70          uint64_t dd_deleg_zapobj; /* dataset delegation permissions */
  70   71          uint64_t dd_flags;
  71   72          uint64_t dd_used_breakdown[DD_USED_NUM];
  72   73          uint64_t dd_clones; /* dsl_dir objects */
  73      -        uint64_t dd_pad[13]; /* pad out to 256 bytes for good measure */
       74 +
       75 +        uint64_t dd_dataset_count;
       76 +        uint64_t dd_snapshot_count;
       77 +
       78 +        uint64_t dd_pad[11]; /* pad out to 256 bytes for good measure */
  74   79  } dsl_dir_phys_t;
  75   80  
  76   81  struct dsl_dir {
  77   82          /* These are immutable; no lock needed: */
  78   83          uint64_t dd_object;
  79   84          dsl_dir_phys_t *dd_phys;
  80   85          dmu_buf_t *dd_dbuf;
  81   86          dsl_pool_t *dd_pool;
  82   87  
  83   88          /* protected by lock on pool's dp_dirty_dirs list */
↓ open down ↓ 40 lines elided ↑ open up ↑
 124  129  void dsl_dir_tempreserve_clear(void *tr_cookie, dmu_tx_t *tx);
 125  130  void dsl_dir_willuse_space(dsl_dir_t *dd, int64_t space, dmu_tx_t *tx);
 126  131  void dsl_dir_diduse_space(dsl_dir_t *dd, dd_used_t type,
 127  132      int64_t used, int64_t compressed, int64_t uncompressed, dmu_tx_t *tx);
 128  133  void dsl_dir_transfer_space(dsl_dir_t *dd, int64_t delta,
 129  134      dd_used_t oldtype, dd_used_t newtype, dmu_tx_t *tx);
 130  135  int dsl_dir_set_quota(const char *ddname, zprop_source_t source,
 131  136      uint64_t quota);
 132  137  int dsl_dir_set_reservation(const char *ddname, zprop_source_t source,
 133  138      uint64_t reservation);
      139 +int dsl_dir_validate_ds_ss_quota(const char *, uint64_t, zfs_prop_t);
      140 +int dsl_dir_dscount_check(dsl_dir_t *, dmu_tx_t *, uint64_t, dsl_dir_t *);
      141 +void dsl_dir_dscount_adjust(dsl_dir_t *, dmu_tx_t *, int64_t, boolean_t,
      142 +    boolean_t);
      143 +int dsl_snapcount_check(dsl_dir_t *, dmu_tx_t *, uint64_t, dsl_dir_t *);
      144 +void dsl_snapcount_adjust(dsl_dir_t *, dmu_tx_t *, int64_t, boolean_t);
 134  145  int dsl_dir_rename(dsl_dir_t *dd, const char *newname);
 135      -int dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd, uint64_t space);
      146 +int dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd,
      147 +    dsl_dir_t *moving_dd, uint64_t space, dmu_tx_t *tx);
 136  148  int dsl_dir_set_reservation_check(void *arg1, void *arg2, dmu_tx_t *tx);
 137  149  boolean_t dsl_dir_is_clone(dsl_dir_t *dd);
 138  150  void dsl_dir_new_refreservation(dsl_dir_t *dd, struct dsl_dataset *ds,
 139  151      uint64_t reservation, cred_t *cr, dmu_tx_t *tx);
 140  152  void dsl_dir_snap_cmtime_update(dsl_dir_t *dd);
 141  153  timestruc_t dsl_dir_snap_cmtime(dsl_dir_t *dd);
 142  154  
 143  155  /* internal reserved dir name */
 144  156  #define MOS_DIR_NAME "$MOS"
 145  157  #define ORIGIN_DIR_NAME "$ORIGIN"
↓ open down ↓ 22 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX