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/zfs_znode.h
          +++ new/usr/src/uts/common/fs/zfs/sys/zfs_znode.h
↓ open down ↓ 130 lines elided ↑ open up ↑
 131  131  #define ZFS_FSID                "FSID"
 132  132  #define ZFS_UNLINKED_SET        "DELETE_QUEUE"
 133  133  #define ZFS_ROOT_OBJ            "ROOT"
 134  134  #define ZPL_VERSION_STR         "VERSION"
 135  135  #define ZFS_FUID_TABLES         "FUID"
 136  136  #define ZFS_SHARES_DIR          "SHARES"
 137  137  #define ZFS_SA_ATTRS            "SA_ATTRS"
 138  138  
 139  139  #define ZFS_MAX_BLOCKSIZE       (SPA_MAXBLOCKSIZE)
 140  140  
 141      -/* Path component length */
 142  141  /*
      142 + * Path component length
      143 + *
 143  144   * The generic fs code uses MAXNAMELEN to represent
 144  145   * what the largest component length is.  Unfortunately,
 145  146   * this length includes the terminating NULL.  ZFS needs
 146  147   * to tell the users via pathconf() and statvfs() what the
 147  148   * true maximum length of a component is, excluding the NULL.
 148  149   */
 149  150  #define ZFS_MAXNAMELEN  (MAXNAMELEN - 1)
 150  151  
 151  152  /*
 152  153   * Convert mode bits (zp_mode) to BSD-style DT_* values for storing in
↓ open down ↓ 74 lines elided ↑ open up ↑
 227  228   *    read needs to be locked as RL_READER. A check against zp_size can then
 228  229   *    be made for reading beyond end of file.
 229  230   */
 230  231  
 231  232  /*
 232  233   * Convert between znode pointers and vnode pointers
 233  234   */
 234  235  #define ZTOV(ZP)        ((ZP)->z_vnode)
 235  236  #define VTOZ(VP)        ((znode_t *)(VP)->v_data)
 236  237  
 237      -/*
 238      - * ZFS_ENTER() is called on entry to each ZFS vnode and vfs operation.
 239      - * ZFS_EXIT() must be called before exitting the vop.
 240      - * ZFS_VERIFY_ZP() verifies the znode is valid.
 241      - */
      238 +/* Called on entry to each ZFS vnode and vfs operation  */
 242  239  #define ZFS_ENTER(zfsvfs) \
 243  240          { \
 244  241                  rrw_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
 245  242                  if ((zfsvfs)->z_unmounted) { \
 246  243                          ZFS_EXIT(zfsvfs); \
 247  244                          return (EIO); \
 248  245                  } \
 249  246          }
 250  247  
      248 +/* Must be called before exiting the vop */
 251  249  #define ZFS_EXIT(zfsvfs) rrw_exit(&(zfsvfs)->z_teardown_lock, FTAG)
 252  250  
      251 +/* Verifies the znode is valid */
 253  252  #define ZFS_VERIFY_ZP(zp) \
 254  253          if ((zp)->z_sa_hdl == NULL) { \
 255  254                  ZFS_EXIT((zp)->z_zfsvfs); \
 256  255                  return (EIO); \
 257  256          } \
 258  257  
 259  258  /*
 260  259   * Macros for dealing with dmu_buf_hold
 261  260   */
 262  261  #define ZFS_OBJ_HASH(obj_num)   ((obj_num) & (ZFS_OBJ_MTX_SZ - 1))
 263  262  #define ZFS_OBJ_MUTEX(zfsvfs, obj_num)  \
 264  263          (&(zfsvfs)->z_hold_mtx[ZFS_OBJ_HASH(obj_num)])
 265  264  #define ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num) \
 266  265          mutex_enter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
 267  266  #define ZFS_OBJ_HOLD_TRYENTER(zfsvfs, obj_num) \
 268  267          mutex_tryenter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
 269  268  #define ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \
 270  269          mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
 271  270  
 272      -/*
 273      - * Macros to encode/decode ZFS stored time values from/to struct timespec
 274      - */
      271 +/* Encode ZFS stored time values from a struct timespec */
 275  272  #define ZFS_TIME_ENCODE(tp, stmp)               \
 276  273  {                                               \
 277  274          (stmp)[0] = (uint64_t)(tp)->tv_sec;     \
 278  275          (stmp)[1] = (uint64_t)(tp)->tv_nsec;    \
 279  276  }
 280  277  
      278 +/* Decode ZFS stored time values to a struct timespec */
 281  279  #define ZFS_TIME_DECODE(tp, stmp)               \
 282  280  {                                               \
 283  281          (tp)->tv_sec = (time_t)(stmp)[0];               \
 284  282          (tp)->tv_nsec = (long)(stmp)[1];                \
 285  283  }
 286  284  
 287  285  /*
 288  286   * Timestamp defines
 289  287   */
 290  288  #define ACCESSED                (AT_ATIME)
↓ open down ↓ 72 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX