Print this page
re #13613 rb4516 Tunables needs volatile keyword


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  23  *
  24  * Copyright 2011, 2012 Nexenta Systems, Inc. All rights reserved.
  25  * Copyright 2013 Joyent, Inc. All rights reserved.
  26  */
  27 
  28 /*
  29  * This is the loadable module wrapper.
  30  */
  31 #include <sys/systm.h>
  32 #include <sys/modctl.h>
  33 #include <sys/syscall.h>
  34 #include <sys/ddi.h>
  35 #include <sys/cmn_err.h>
  36 
  37 #include <nfs/nfs.h>
  38 #include <nfs/nfs_clnt.h>
  39 #include <nfs/nfs4.h>
  40 #include <nfs/rnode4.h>
  41 
  42 /*
  43  * The global tag list.
  44  */
  45 ctag_t nfs4_ctags[] = NFS4_TAG_INITIALIZER;
  46 
  47 /*
  48  * The NFS Version 4 client VFS.
  49  */
  50 static vfsdef_t vfw4 = {
  51         VFSDEF_VERSION,
  52         "nfs4",
  53         nfs4init,
  54         VSW_CANREMOUNT|VSW_NOTZONESAFE|VSW_STATS,
  55         NULL
  56 };
  57 
  58 struct modlfs modlfs4 = {
  59         &mod_fsops,
  60         "network filesystem version 4",
  61         &vfw4
  62 };
  63 
  64 uint_t nfs4_max_transfer_size = 32 * 1024;
  65 uint_t nfs4_max_transfer_size_cots = 1024 * 1024;
  66 uint_t nfs4_max_transfer_size_rdma = 1024 * 1024;
  67 
  68 int
  69 nfs4tsize(void)
  70 {
  71         /*
  72          * For the moment, just return nfs4_max_transfer_size until we
  73          * can query the appropriate transport.
  74          */
  75         return (nfs4_max_transfer_size);
  76 }
  77 
  78 uint_t
  79 nfs4_tsize(struct knetconfig *knp)
  80 {
  81 
  82         if (knp->knc_semantics == NC_TPI_COTS_ORD ||
  83             knp->knc_semantics == NC_TPI_COTS)
  84                 return (nfs4_max_transfer_size_cots);
  85         if (knp->knc_semantics == NC_TPI_RDMA)
  86                 return (nfs4_max_transfer_size_rdma);




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.

  24  * Copyright 2013 Joyent, Inc. All rights reserved.
  25  */
  26 
  27 /*
  28  * This is the loadable module wrapper.
  29  */
  30 #include <sys/systm.h>
  31 #include <sys/modctl.h>
  32 #include <sys/syscall.h>
  33 #include <sys/ddi.h>
  34 #include <sys/cmn_err.h>
  35 
  36 #include <nfs/nfs.h>
  37 #include <nfs/nfs_clnt.h>
  38 #include <nfs/nfs4.h>
  39 #include <nfs/rnode4.h>
  40 
  41 /*
  42  * The global tag list.
  43  */
  44 ctag_t nfs4_ctags[] = NFS4_TAG_INITIALIZER;
  45 
  46 /*
  47  * The NFS Version 4 client VFS.
  48  */
  49 static vfsdef_t vfw4 = {
  50         VFSDEF_VERSION,
  51         "nfs4",
  52         nfs4init,
  53         VSW_CANREMOUNT|VSW_NOTZONESAFE|VSW_STATS,
  54         NULL
  55 };
  56 
  57 struct modlfs modlfs4 = {
  58         &mod_fsops,
  59         "network filesystem version 4",
  60         &vfw4
  61 };
  62 
  63 volatile uint_t nfs4_max_transfer_size = 32 * 1024;
  64 volatile uint_t nfs4_max_transfer_size_cots = 1024 * 1024;
  65 volatile uint_t nfs4_max_transfer_size_rdma = 1024 * 1024;
  66 
  67 int
  68 nfs4tsize(void)
  69 {
  70         /*
  71          * For the moment, just return nfs4_max_transfer_size until we
  72          * can query the appropriate transport.
  73          */
  74         return (nfs4_max_transfer_size);
  75 }
  76 
  77 uint_t
  78 nfs4_tsize(struct knetconfig *knp)
  79 {
  80 
  81         if (knp->knc_semantics == NC_TPI_COTS_ORD ||
  82             knp->knc_semantics == NC_TPI_COTS)
  83                 return (nfs4_max_transfer_size_cots);
  84         if (knp->knc_semantics == NC_TPI_RDMA)
  85                 return (nfs4_max_transfer_size_rdma);