Print this page
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dmu_send.c
          +++ new/usr/src/uts/common/fs/zfs/dmu_send.c
↓ open down ↓ 49 lines elided ↑ open up ↑
  50   50  /* Set this tunable to TRUE to replace corrupt data with 0x2f5baddb10c */
  51   51  int zfs_send_corrupt_data = B_FALSE;
  52   52  
  53   53  static char *dmu_recv_tag = "dmu_recv_tag";
  54   54  
  55   55  static int
  56   56  dump_bytes(dmu_sendarg_t *dsp, void *buf, int len)
  57   57  {
  58   58          dsl_dataset_t *ds = dsp->dsa_os->os_dsl_dataset;
  59   59          ssize_t resid; /* have to get resid to get detailed errno */
  60      -        ASSERT3U(len % 8, ==, 0);
       60 +        ASSERT0(len % 8);
  61   61  
  62   62          fletcher_4_incremental_native(buf, len, &dsp->dsa_zc);
  63   63          dsp->dsa_err = vn_rdwr(UIO_WRITE, dsp->dsa_vp,
  64   64              (caddr_t)buf, len,
  65   65              0, UIO_SYSSPACE, FAPPEND, RLIM64_INFINITY, CRED(), &resid);
  66   66  
  67   67          mutex_enter(&ds->ds_sendstream_lock);
  68   68          *dsp->dsa_off += len;
  69   69          mutex_exit(&ds->ds_sendstream_lock);
  70   70  
↓ open down ↓ 883 lines elided ↑ open up ↑
 954  954          kmem_free(ca, sizeof (avl_tree_t));
 955  955  }
 956  956  
 957  957  static void *
 958  958  restore_read(struct restorearg *ra, int len)
 959  959  {
 960  960          void *rv;
 961  961          int done = 0;
 962  962  
 963  963          /* some things will require 8-byte alignment, so everything must */
 964      -        ASSERT3U(len % 8, ==, 0);
      964 +        ASSERT0(len % 8);
 965  965  
 966  966          while (done < len) {
 967  967                  ssize_t resid;
 968  968  
 969  969                  ra->err = vn_rdwr(UIO_READ, ra->vp,
 970  970                      (caddr_t)ra->buf + done, len - done,
 971  971                      ra->voff, UIO_SYSSPACE, FAPPEND,
 972  972                      RLIM64_INFINITY, CRED(), &resid);
 973  973  
 974  974                  if (resid == len - done)
↓ open down ↓ 663 lines elided ↑ open up ↑
1638 1638                  /* swap back */
1639 1639                  (void) dsl_dataset_clone_swap(drc->drc_real_ds, ds, B_TRUE);
1640 1640          }
1641 1641  
1642 1642  out:
1643 1643          mutex_exit(&ds->ds_recvlock);
1644 1644          if (err == 0 && drc->drc_guid_to_ds_map != NULL)
1645 1645                  (void) add_ds_to_guidmap(drc->drc_guid_to_ds_map, ds);
1646 1646          dsl_dataset_disown(ds, dmu_recv_tag);
1647 1647          myerr = dsl_dataset_destroy(drc->drc_real_ds, dmu_recv_tag, B_FALSE);
1648      -        ASSERT3U(myerr, ==, 0);
     1648 +        ASSERT0(myerr);
1649 1649          return (err);
1650 1650  }
1651 1651  
1652 1652  static int
1653 1653  dmu_recv_new_end(dmu_recv_cookie_t *drc)
1654 1654  {
1655 1655          struct recvendsyncarg resa;
1656 1656          dsl_dataset_t *ds = drc->drc_logical_ds;
1657 1657          int err;
1658 1658  
↓ open down ↓ 33 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX