Print this page
cstyle fixes
dsl_dataset_set_fsid_guid should use ZFS_SPACE_CHECK_RESERVED
dsl_dataset_set_fsid_guid _check and _sync func declared static,
removed from dsl_dataset.h
rewrite unique_valid
6333 ZFS should let the user specify or modify the fsid_guid of a dataset

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/unique.c
          +++ new/usr/src/uts/common/fs/zfs/unique.c
↓ open down ↓ 91 lines elided ↑ open up ↑
  92   92                  un->un_value &= UNIQUE_MASK;
  93   93                  mutex_enter(&unique_mtx);
  94   94          }
  95   95  
  96   96          avl_insert(&unique_avl, un, idx);
  97   97          mutex_exit(&unique_mtx);
  98   98  
  99   99          return (un->un_value);
 100  100  }
 101  101  
      102 +boolean_t
      103 +unique_valid(uint64_t value)
      104 +{
      105 +        unique_t un_tofind;
      106 +
      107 +        un_tofind.un_value = value;
      108 +
      109 +        mutex_enter(&unique_mtx);
      110 +        boolean_t rv = ((value & ~UNIQUE_MASK) == 0 &&
      111 +            avl_find(&unique_avl, &un_tofind, NULL) == NULL);
      112 +        mutex_exit(&unique_mtx);
      113 +
      114 +        return (rv);
      115 +}
      116 +
 102  117  void
 103  118  unique_remove(uint64_t value)
 104  119  {
 105  120          unique_t un_tofind;
 106  121          unique_t *un;
 107  122  
 108  123          un_tofind.un_value = value;
 109  124          mutex_enter(&unique_mtx);
 110  125          un = avl_find(&unique_avl, &un_tofind, NULL);
 111  126          if (un != NULL) {
 112  127                  avl_remove(&unique_avl, un);
 113  128                  kmem_free(un, sizeof (unique_t));
 114  129          }
 115  130          mutex_exit(&unique_mtx);
 116  131  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX