Print this page
4185 New hash algorithm support

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/arc.c
          +++ new/usr/src/uts/common/fs/zfs/arc.c
↓ open down ↓ 972 lines elided ↑ open up ↑
 973  973  
 974  974          if (!(zfs_flags & ZFS_DEBUG_MODIFY))
 975  975                  return;
 976  976  
 977  977          mutex_enter(&buf->b_hdr->b_freeze_lock);
 978  978          if (buf->b_hdr->b_freeze_cksum == NULL ||
 979  979              (buf->b_hdr->b_flags & ARC_IO_ERROR)) {
 980  980                  mutex_exit(&buf->b_hdr->b_freeze_lock);
 981  981                  return;
 982  982          }
 983      -        fletcher_2_native(buf->b_data, buf->b_hdr->b_size, &zc);
      983 +        fletcher_2_native(buf->b_data, buf->b_hdr->b_size, NULL, NULL, &zc);
 984  984          if (!ZIO_CHECKSUM_EQUAL(*buf->b_hdr->b_freeze_cksum, zc))
 985  985                  panic("buffer modified while frozen!");
 986  986          mutex_exit(&buf->b_hdr->b_freeze_lock);
 987  987  }
 988  988  
 989  989  static int
 990  990  arc_cksum_equal(arc_buf_t *buf)
 991  991  {
 992  992          zio_cksum_t zc;
 993  993          int equal;
 994  994  
 995  995          mutex_enter(&buf->b_hdr->b_freeze_lock);
 996      -        fletcher_2_native(buf->b_data, buf->b_hdr->b_size, &zc);
      996 +        fletcher_2_native(buf->b_data, buf->b_hdr->b_size, NULL, NULL, &zc);
 997  997          equal = ZIO_CHECKSUM_EQUAL(*buf->b_hdr->b_freeze_cksum, zc);
 998  998          mutex_exit(&buf->b_hdr->b_freeze_lock);
 999  999  
1000 1000          return (equal);
1001 1001  }
1002 1002  
1003 1003  static void
1004 1004  arc_cksum_compute(arc_buf_t *buf, boolean_t force)
1005 1005  {
1006 1006          if (!force && !(zfs_flags & ZFS_DEBUG_MODIFY))
1007 1007                  return;
1008 1008  
1009 1009          mutex_enter(&buf->b_hdr->b_freeze_lock);
1010 1010          if (buf->b_hdr->b_freeze_cksum != NULL) {
1011 1011                  mutex_exit(&buf->b_hdr->b_freeze_lock);
1012 1012                  return;
1013 1013          }
1014 1014          buf->b_hdr->b_freeze_cksum = kmem_alloc(sizeof (zio_cksum_t), KM_SLEEP);
1015      -        fletcher_2_native(buf->b_data, buf->b_hdr->b_size,
     1015 +        fletcher_2_native(buf->b_data, buf->b_hdr->b_size, NULL, NULL,
1016 1016              buf->b_hdr->b_freeze_cksum);
1017 1017          mutex_exit(&buf->b_hdr->b_freeze_lock);
1018 1018          arc_buf_watch(buf);
1019 1019  }
1020 1020  
1021 1021  #ifndef _KERNEL
1022 1022  typedef struct procctl {
1023 1023          long cmd;
1024 1024          prwatch_t prwatch;
1025 1025  } procctl_t;
↓ open down ↓ 4174 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX