Print this page
3741 zfs needs better comments
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Justin Gibbs <justing@spectralogic.com>
Submitted by:   Alan Somers <alans@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/common/zfs/zfs_fletcher.c
          +++ new/usr/src/common/zfs/zfs_fletcher.c
↓ open down ↓ 117 lines elided ↑ open up ↑
 118  118   * which has been filled either by:
 119  119   *
 120  120   *      1. a compression step, which will be mostly cached, or
 121  121   *      2. a bcopy() or copyin(), which will be uncached (because the
 122  122   *         copy is cache-bypassing).
 123  123   *
 124  124   * For both cached and uncached data, both fletcher checksums are much faster
 125  125   * than sha-256, and slower than 'off', which doesn't touch the data at all.
 126  126   */
 127  127  
      128 +/*
      129 + * TODO: vectorize these functions
      130 + * All of these functions are written so that each iteration of the loop
      131 + * depends on the value of the previous iteration.  Also, in the fletcher_4
      132 + * functions, each statement of the loop body depends on the previous
      133 + * statement.  These dependencies prevent the compiler from vectorizing the
      134 + * code to take advantage of SIMD extensions (unless GCC is far smarter than I
      135 + * think).  It would be easy to rewrite the loops to be amenable to
      136 + * autovectorization.
      137 + */
      138 +
 128  139  #include <sys/types.h>
 129  140  #include <sys/sysmacros.h>
 130  141  #include <sys/byteorder.h>
 131  142  #include <sys/zio.h>
 132  143  #include <sys/spa.h>
 133  144  
 134  145  void
 135  146  fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp)
 136  147  {
 137  148          const uint64_t *ip = buf;
↓ open down ↓ 109 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX