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_rlock.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_rlock.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*
       27 + * Copyright (c) 2012 by Delphix. All rights reserved.
       28 + */
       29 +
       30 +
       31 +
       32 +/*
  27   33   * This file contains the code to implement file range locking in
  28   34   * ZFS, although there isn't much specific to ZFS (all that comes to mind
  29   35   * support for growing the blocksize).
  30   36   *
  31   37   * Interface
  32   38   * ---------
  33   39   * Defined in zfs_rlock.h but essentially:
  34   40   *      rl = zfs_range_lock(zp, off, len, lock_type);
  35   41   *      zfs_range_unlock(rl);
  36   42   *      zfs_range_reduce(rl, off, len);
↓ open down ↓ 437 lines elided ↑ open up ↑
 474  480                  avl_remove(tree, remove);
 475  481                  if (remove->r_write_wanted) {
 476  482                          cv_broadcast(&remove->r_wr_cv);
 477  483                          cv_destroy(&remove->r_wr_cv);
 478  484                  }
 479  485                  if (remove->r_read_wanted) {
 480  486                          cv_broadcast(&remove->r_rd_cv);
 481  487                          cv_destroy(&remove->r_rd_cv);
 482  488                  }
 483  489          } else {
 484      -                ASSERT3U(remove->r_cnt, ==, 0);
 485      -                ASSERT3U(remove->r_write_wanted, ==, 0);
 486      -                ASSERT3U(remove->r_read_wanted, ==, 0);
      490 +                ASSERT0(remove->r_cnt);
      491 +                ASSERT0(remove->r_write_wanted);
      492 +                ASSERT0(remove->r_read_wanted);
 487  493                  /*
 488  494                   * Find start proxy representing this reader lock,
 489  495                   * then decrement ref count on all proxies
 490  496                   * that make up this range, freeing them as needed.
 491  497                   */
 492  498                  rl = avl_find(tree, remove, NULL);
 493  499                  ASSERT(rl);
 494  500                  ASSERT(rl->r_cnt);
 495  501                  ASSERT(rl->r_type == RL_READER);
 496  502                  for (len = remove->r_len; len != 0; rl = next) {
↓ open down ↓ 106 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX