Print this page
3742 zfs comments need cleaner, more consistent style
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Alan Somers <alans@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>
Reviewed by:    George Wilson <george.wilson@delphix.com>
Reviewed by:    Eric Schrock <eric.schrock@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/sys/zap_leaf.h
          +++ new/usr/src/uts/common/fs/zfs/sys/zap_leaf.h
↓ open down ↓ 93 lines elided ↑ open up ↑
  94   94  } zap_chunk_type_t;
  95   95  
  96   96  #define ZLF_ENTRIES_CDSORTED (1<<0)
  97   97  
  98   98  /*
  99   99   * TAKE NOTE:
 100  100   * If zap_leaf_phys_t is modified, zap_leaf_byteswap() must be modified.
 101  101   */
 102  102  typedef struct zap_leaf_phys {
 103  103          struct zap_leaf_header {
      104 +                /* Public to ZAP */
 104  105                  uint64_t lh_block_type;         /* ZBT_LEAF */
 105  106                  uint64_t lh_pad1;
 106  107                  uint64_t lh_prefix;             /* hash prefix of this leaf */
 107  108                  uint32_t lh_magic;              /* ZAP_LEAF_MAGIC */
 108  109                  uint16_t lh_nfree;              /* number free chunks */
 109  110                  uint16_t lh_nentries;           /* number of entries */
 110  111                  uint16_t lh_prefix_len;         /* num bits used to id this */
 111  112  
 112      -/* above is accessable to zap, below is zap_leaf private */
 113      -
      113 +                /* Private to zap_leaf */
 114  114                  uint16_t lh_freelist;           /* chunk head of free list */
 115  115                  uint8_t lh_flags;               /* ZLF_* flags */
 116  116                  uint8_t lh_pad2[11];
 117  117          } l_hdr; /* 2 24-byte chunks */
 118  118  
 119  119          /*
 120  120           * The header is followed by a hash table with
 121  121           * ZAP_LEAF_HASH_NUMENTRIES(zap) entries.  The hash table is
 122  122           * followed by an array of ZAP_LEAF_NUMCHUNKS(zap)
 123  123           * zap_leaf_chunk structures.  These structures are accessed
↓ open down ↓ 30 lines elided ↑ open up ↑
 154  154  typedef struct zap_leaf {
 155  155          krwlock_t l_rwlock;
 156  156          uint64_t l_blkid;               /* 1<<ZAP_BLOCK_SHIFT byte block off */
 157  157          int l_bs;                       /* block size shift */
 158  158          dmu_buf_t *l_dbuf;
 159  159          zap_leaf_phys_t *l_phys;
 160  160  } zap_leaf_t;
 161  161  
 162  162  
 163  163  typedef struct zap_entry_handle {
 164      -        /* below is set by zap_leaf.c and is public to zap.c */
      164 +        /* Set by zap_leaf and public to ZAP */
 165  165          uint64_t zeh_num_integers;
 166  166          uint64_t zeh_hash;
 167  167          uint32_t zeh_cd;
 168  168          uint8_t zeh_integer_size;
 169  169  
 170      -        /* below is private to zap_leaf.c */
      170 +        /* Private to zap_leaf */
 171  171          uint16_t zeh_fakechunk;
 172  172          uint16_t *zeh_chunkp;
 173  173          zap_leaf_t *zeh_leaf;
 174  174  } zap_entry_handle_t;
 175  175  
 176  176  /*
 177  177   * Return a handle to the named entry, or ENOENT if not found.  The hash
 178  178   * value must equal zap_hash(name).
 179  179   */
 180  180  extern int zap_leaf_lookup(zap_leaf_t *l,
↓ open down ↓ 14 lines elided ↑ open up ↑
 195  195   */
 196  196  extern int zap_entry_read(const zap_entry_handle_t *zeh,
 197  197      uint8_t integer_size, uint64_t num_integers, void *buf);
 198  198  
 199  199  extern int zap_entry_read_name(struct zap *zap, const zap_entry_handle_t *zeh,
 200  200      uint16_t buflen, char *buf);
 201  201  
 202  202  /*
 203  203   * Replace the value of an existing entry.
 204  204   *
 205      - * zap_entry_update may fail if it runs out of space (ENOSPC).
      205 + * May fail if it runs out of space (ENOSPC).
 206  206   */
 207  207  extern int zap_entry_update(zap_entry_handle_t *zeh,
 208  208      uint8_t integer_size, uint64_t num_integers, const void *buf);
 209  209  
 210  210  /*
 211  211   * Remove an entry.
 212  212   */
 213  213  extern void zap_entry_remove(zap_entry_handle_t *zeh);
 214  214  
 215  215  /*
 216  216   * Create an entry. An equal entry must not exist, and this entry must
 217  217   * belong in this leaf (according to its hash value).  Fills in the
 218  218   * entry handle on success.  Returns 0 on success or ENOSPC on failure.
 219  219   */
 220  220  extern int zap_entry_create(zap_leaf_t *l, struct zap_name *zn, uint32_t cd,
 221  221      uint8_t integer_size, uint64_t num_integers, const void *buf,
 222  222      zap_entry_handle_t *zeh);
 223  223  
 224      -/*
 225      - * Return true if there are additional entries with the same normalized
 226      - * form.
 227      - */
      224 +/* Determine whether there is another entry with the same normalized form. */
 228  225  extern boolean_t zap_entry_normalization_conflict(zap_entry_handle_t *zeh,
 229  226      struct zap_name *zn, const char *name, struct zap *zap);
 230  227  
 231  228  /*
 232  229   * Other stuff.
 233  230   */
 234  231  
 235  232  extern void zap_leaf_init(zap_leaf_t *l, boolean_t sort);
 236  233  extern void zap_leaf_byteswap(zap_leaf_phys_t *buf, int len);
 237  234  extern void zap_leaf_split(zap_leaf_t *l, zap_leaf_t *nl, boolean_t sort);
 238  235  extern void zap_leaf_stats(struct zap *zap, zap_leaf_t *l,
 239  236      struct zap_stats *zs);
 240  237  
 241  238  #ifdef  __cplusplus
 242  239  }
 243  240  #endif
 244  241  
 245  242  #endif /* _SYS_ZAP_LEAF_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX