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_dir.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_dir.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  
  25   26  #include <sys/types.h>
  26   27  #include <sys/param.h>
  27   28  #include <sys/time.h>
  28   29  #include <sys/systm.h>
  29   30  #include <sys/sysmacros.h>
  30   31  #include <sys/resource.h>
  31   32  #include <sys/vfs.h>
  32   33  #include <sys/vnode.h>
↓ open down ↓ 414 lines elided ↑ open up ↑
 447  448   * nondebug system, this will result in the space being leaked.
 448  449   */
 449  450  void
 450  451  zfs_unlinked_add(znode_t *zp, dmu_tx_t *tx)
 451  452  {
 452  453          zfsvfs_t *zfsvfs = zp->z_zfsvfs;
 453  454  
 454  455          ASSERT(zp->z_unlinked);
 455  456          ASSERT(zp->z_links == 0);
 456  457  
 457      -        VERIFY3U(0, ==,
 458      -            zap_add_int(zfsvfs->z_os, zfsvfs->z_unlinkedobj, zp->z_id, tx));
      458 +        VERIFY0(zap_add_int(zfsvfs->z_os, zfsvfs->z_unlinkedobj,
      459 +            zp->z_id, tx));
 459  460  }
 460  461  
 461  462  /*
 462  463   * Clean up any znodes that had no links when we either crashed or
 463  464   * (force) umounted the file system.
 464  465   */
 465  466  void
 466  467  zfs_unlinked_drain(zfsvfs_t *zfsvfs)
 467  468  {
 468  469          zap_cursor_t    zc;
↓ open down ↓ 195 lines elided ↑ open up ↑
 664  665                  mutex_enter(&xzp->z_lock);
 665  666                  xzp->z_unlinked = B_TRUE;       /* mark xzp for deletion */
 666  667                  xzp->z_links = 0;       /* no more links to it */
 667  668                  VERIFY(0 == sa_update(xzp->z_sa_hdl, SA_ZPL_LINKS(zfsvfs),
 668  669                      &xzp->z_links, sizeof (xzp->z_links), tx));
 669  670                  mutex_exit(&xzp->z_lock);
 670  671                  zfs_unlinked_add(xzp, tx);
 671  672          }
 672  673  
 673  674          /* Remove this znode from the unlinked set */
 674      -        VERIFY3U(0, ==,
 675      -            zap_remove_int(zfsvfs->z_os, zfsvfs->z_unlinkedobj, zp->z_id, tx));
      675 +        VERIFY0(zap_remove_int(zfsvfs->z_os, zfsvfs->z_unlinkedobj,
      676 +            xzp->z_id, tx));
 676  677  
 677  678          zfs_znode_delete(zp, tx);
 678  679  
 679  680          dmu_tx_commit(tx);
 680  681  out:
 681  682          if (xzp)
 682  683                  VN_RELE(ZTOV(xzp));
 683  684  }
 684  685  
 685  686  static uint64_t
↓ open down ↓ 404 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX