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/zfs_znode.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_znode.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright (c) 2012 by Delphix. All rights reserved.
  23   24   */
  24   25  
       26 +
  25   27  /* Portions Copyright 2007 Jeremy Teo */
  26   28  
  27   29  #ifdef _KERNEL
  28   30  #include <sys/types.h>
  29   31  #include <sys/param.h>
  30   32  #include <sys/time.h>
  31   33  #include <sys/systm.h>
  32   34  #include <sys/sysmacros.h>
  33   35  #include <sys/resource.h>
  34   36  #include <sys/mntent.h>
↓ open down ↓ 764 lines elided ↑ open up ↑
 799  801           * There's currently no mechanism for pre-reading the blocks that will
 800  802           * be needed to allocate a new object, so we accept the small chance
 801  803           * that there will be an i/o error and we will fail one of the
 802  804           * assertions below.
 803  805           */
 804  806          if (vap->va_type == VDIR) {
 805  807                  if (zfsvfs->z_replay) {
 806  808                          err = zap_create_claim_norm(zfsvfs->z_os, obj,
 807  809                              zfsvfs->z_norm, DMU_OT_DIRECTORY_CONTENTS,
 808  810                              obj_type, bonuslen, tx);
 809      -                        ASSERT3U(err, ==, 0);
      811 +                        ASSERT0(err);
 810  812                  } else {
 811  813                          obj = zap_create_norm(zfsvfs->z_os,
 812  814                              zfsvfs->z_norm, DMU_OT_DIRECTORY_CONTENTS,
 813  815                              obj_type, bonuslen, tx);
 814  816                  }
 815  817          } else {
 816  818                  if (zfsvfs->z_replay) {
 817  819                          err = dmu_object_claim(zfsvfs->z_os, obj,
 818  820                              DMU_OT_PLAIN_FILE_CONTENTS, 0,
 819  821                              obj_type, bonuslen, tx);
 820      -                        ASSERT3U(err, ==, 0);
      822 +                        ASSERT0(err);
 821  823                  } else {
 822  824                          obj = dmu_object_alloc(zfsvfs->z_os,
 823  825                              DMU_OT_PLAIN_FILE_CONTENTS, 0,
 824  826                              obj_type, bonuslen, tx);
 825  827                  }
 826  828          }
 827  829  
 828  830          ZFS_OBJ_HOLD_ENTER(zfsvfs, obj);
 829  831          VERIFY(0 == sa_buf_hold(zfsvfs->z_os, obj, NULL, &db));
 830  832  
↓ open down ↓ 161 lines elided ↑ open up ↑
 992  994  
 993  995          (*zpp)->z_pflags = pflags;
 994  996          (*zpp)->z_mode = mode;
 995  997  
 996  998          if (vap->va_mask & AT_XVATTR)
 997  999                  zfs_xvattr_set(*zpp, (xvattr_t *)vap, tx);
 998 1000  
 999 1001          if (obj_type == DMU_OT_ZNODE ||
1000 1002              acl_ids->z_aclp->z_version < ZFS_ACL_VERSION_FUID) {
1001 1003                  err = zfs_aclset_common(*zpp, acl_ids->z_aclp, cr, tx);
1002      -                ASSERT3P(err, ==, 0);
     1004 +                ASSERT0(err);
1003 1005          }
1004 1006          ZFS_OBJ_HOLD_EXIT(zfsvfs, obj);
1005 1007  }
1006 1008  
1007 1009  /*
1008 1010   * zfs_xvattr_set only updates the in-core attributes
1009 1011   * it is assumed the caller will be doing an sa_bulk_update
1010 1012   * to push the changes out
1011 1013   */
1012 1014  void
↓ open down ↓ 400 lines elided ↑ open up ↑
1413 1415           * the blocksize cannot change.
1414 1416           */
1415 1417          if (zp->z_blksz && zp->z_size > zp->z_blksz)
1416 1418                  return;
1417 1419  
1418 1420          error = dmu_object_set_blocksize(zp->z_zfsvfs->z_os, zp->z_id,
1419 1421              size, 0, tx);
1420 1422  
1421 1423          if (error == ENOTSUP)
1422 1424                  return;
1423      -        ASSERT3U(error, ==, 0);
     1425 +        ASSERT0(error);
1424 1426  
1425 1427          /* What blocksize did we actually get? */
1426 1428          dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &zp->z_blksz, &dummy);
1427 1429  }
1428 1430  
1429 1431  /*
1430 1432   * This is a dummy interface used when pvn_vplist_dirty() should *not*
1431 1433   * be calling back into the fs for a putpage().  E.g.: when truncating
1432 1434   * a file, the pages being "thrown away* don't need to be written out.
1433 1435   */
↓ open down ↓ 688 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX