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/sa.c
          +++ new/usr/src/uts/common/fs/zfs/sa.c
↓ open down ↓ 103 lines elided ↑ open up ↑
 104  104   *
 105  105   * A special interface is provided to allow for quickly applying
 106  106   * a large set of attributes at once.  sa_replace_all_by_template() is
 107  107   * used to set an array of attributes.  This is used by the ZPL when
 108  108   * creating a brand new file.  The template that is passed into the function
 109  109   * specifies the attribute, size for variable length attributes, location of
 110  110   * data and special "data locator" function if the data isn't in a contiguous
 111  111   * location.
 112  112   *
 113  113   * Byteswap implications:
      114 + *
 114  115   * Since the SA attributes are not entirely self describing we can't do
 115  116   * the normal byteswap processing.  The special ZAP layout attribute and
 116  117   * attribute registration attributes define the byteswap function and the
 117  118   * size of the attributes, unless it is variable sized.
 118  119   * The normal ZFS byteswapping infrastructure assumes you don't need
 119  120   * to read any objects in order to do the necessary byteswapping.  Whereas
 120  121   * SA attributes can only be properly byteswapped if the dataset is opened
 121  122   * and the layout/attribute ZAP attributes are available.  Because of this
 122  123   * the SA attributes will be byteswapped when they are first accessed by
 123  124   * the SA code that will read the SA data.
↓ open down ↓ 58 lines elided ↑ open up ↑
 182  183          {"ZPL_XATTR", sizeof (uint64_t), SA_UINT64_ARRAY, 9},
 183  184          {"ZPL_RDEV", sizeof (uint64_t), SA_UINT64_ARRAY, 10},
 184  185          {"ZPL_FLAGS", sizeof (uint64_t), SA_UINT64_ARRAY, 11},
 185  186          {"ZPL_UID", sizeof (uint64_t), SA_UINT64_ARRAY, 12},
 186  187          {"ZPL_GID", sizeof (uint64_t), SA_UINT64_ARRAY, 13},
 187  188          {"ZPL_PAD", sizeof (uint64_t) * 4, SA_UINT64_ARRAY, 14},
 188  189          {"ZPL_ZNODE_ACL", 88, SA_UINT8_ARRAY, 15},
 189  190  };
 190  191  
 191  192  /*
 192      - * ZPL legacy layout
 193  193   * This is only used for objects of type DMU_OT_ZNODE
 194  194   */
 195  195  sa_attr_type_t sa_legacy_zpl_layout[] = {
 196  196      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
 197  197  };
 198  198  
 199  199  /*
 200  200   * Special dummy layout used for buffers with no attributes.
 201  201   */
 202      -
 203  202  sa_attr_type_t sa_dummy_zpl_layout[] = { 0 };
 204  203  
 205  204  static int sa_legacy_attr_count = 16;
 206  205  static kmem_cache_t *sa_cache = NULL;
 207  206  
 208  207  /*ARGSUSED*/
 209  208  static int
 210  209  sa_cache_constructor(void *buf, void *unused, int kmflag)
 211  210  {
 212  211          sa_handle_t *hdl = buf;
↓ open down ↓ 1782 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX