Print this page
re #13613 rb4516 Tunables needs volatile keyword

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/dnlc.c
          +++ new/usr/src/uts/common/fs/dnlc.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 2013 Nexenta Systems, Inc.  All rights reserved.
  23   24   * Copyright (c) 2015, Joyent, Inc.
  24   25   * Copyright (c) 2017 by Delphix. All rights reserved.
  25   26   */
  26   27  
  27   28  /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T     */
  28   29  /*        All Rights Reserved   */
  29   30  
  30   31  /*
  31   32   * University Copyright- Copyright (c) 1982, 1986, 1988
  32   33   * The Regents of the University of California
↓ open down ↓ 104 lines elided ↑ open up ↑
 137  138  static nc_hash_t *dnlc_purge_fs1_rotor;
 138  139  static nc_hash_t *dnlc_free_rotor;
 139  140  
 140  141  /*
 141  142   * # of dnlc entries (uninitialized)
 142  143   *
 143  144   * the initial value was chosen as being
 144  145   * a random string of bits, probably not
 145  146   * normally chosen by a systems administrator
 146  147   */
 147      -int ncsize = -1;
      148 +volatile int ncsize = -1;
 148  149  volatile uint32_t dnlc_nentries = 0;    /* current num of name cache entries */
 149  150  static int nc_hashsz;                   /* size of hash table */
 150  151  static int nc_hashmask;                 /* size of hash table minus 1 */
 151  152  
 152  153  /*
 153  154   * The dnlc_reduce_cache() taskq queue is activated when there are
 154  155   * ncsize name cache entries and if no parameter is provided, it reduces
 155  156   * the size down to dnlc_nentries_low_water, which is by default one
 156  157   * hundreth less (or 99%) of ncsize.
 157  158   *
↓ open down ↓ 138 lines elided ↑ open up ↑
 296  297   * 2) DC_RET_LOW_MEM (-1): There was a directory cache that found to be
 297  298   *    too big or a memory shortage occurred. This value remains in the
 298  299   *    pointer until a dnlc_dir_start() which returns the a DNOMEM error.
 299  300   *    This is kludgy but efficient and only visible in this source file.
 300  301   * 3) A valid cache pointer.
 301  302   */
 302  303  #define DC_RET_LOW_MEM (dircache_t *)1
 303  304  #define VALID_DIR_CACHE(dcp) ((dircache_t *)(dcp) > DC_RET_LOW_MEM)
 304  305  
 305  306  /* Tunables */
 306      -uint_t dnlc_dir_enable = 1; /* disable caching directories by setting to 0 */
 307      -uint_t dnlc_dir_min_size = 40; /* min no of directory entries before caching */
 308      -uint_t dnlc_dir_max_size = UINT_MAX; /* ditto maximum */
      307 +volatile uint_t dnlc_dir_enable = 1;    /* disable caching directories by */
      308 +                                        /* setting to 0 */
      309 +volatile uint_t dnlc_dir_min_size = 40; /* min no of directory entries before */
      310 +                                        /* caching */
      311 +volatile uint_t dnlc_dir_max_size = UINT_MAX; /* ditto maximum */
 309  312  uint_t dnlc_dir_hash_size_shift = 3; /* 8 entries per hash bucket */
 310  313  uint_t dnlc_dir_min_reclaim =  350000; /* approx 1MB of dcentrys */
 311  314  /*
 312  315   * dnlc_dir_hash_resize_shift determines when the hash tables
 313  316   * get re-adjusted due to growth or shrinkage
 314  317   * - currently 2 indicating that there can be at most 4
 315  318   * times or at least one quarter the number of entries
 316  319   * before hash table readjustment. Note that with
 317  320   * dnlc_dir_hash_size_shift above set at 3 this would
 318  321   * mean readjustment would occur if the average number
↓ open down ↓ 1663 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX