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) 1986, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2017 by Delphix. All rights reserved.
  24  */
  25 
  26 /*
  27  *      Copyright (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  28  *      All Rights Reserved
  29  */
  30 
  31 #include <sys/param.h>
  32 #include <sys/types.h>
  33 #include <sys/systm.h>
  34 #include <sys/thread.h>
  35 #include <sys/t_lock.h>
  36 #include <sys/time.h>
  37 #include <sys/vnode.h>
  38 #include <sys/vfs.h>
  39 #include <sys/errno.h>
  40 #include <sys/buf.h>
  41 #include <sys/stat.h>
  42 #include <sys/cred.h>
 
 
1377  * from the queues in a round-robin fashion.  A number of consecutive
1378  * requests are taken from each queue before moving on to the next
1379  * queue.  This functionality may allow the NFS Version 2 server to do
1380  * write clustering, even if the client is mixing writes and reads
1381  * because it will take multiple write requests from the queue
1382  * before processing any of the other async i/o types.
1383  *
1384  * XXX The nfs4_async_common_start thread is unsafe in the light of the present
1385  * model defined by cpr to suspend the system. Specifically over the
1386  * wire calls are cpr-unsafe. The thread should be reevaluated in
1387  * case of future updates to the cpr model.
1388  */
1389 static void
1390 nfs4_async_common_start(struct vfs *vfsp, int async_queue)
1391 {
1392         struct nfs4_async_reqs *args;
1393         mntinfo4_t *mi = VFTOMI4(vfsp);
1394         clock_t time_left = 1;
1395         callb_cpr_t cprinfo;
1396         int i;
1397         extern int nfs_async_timeout;
1398         int async_types;
1399         kcondvar_t *async_work_cv;
1400 
1401         if (async_queue == NFS4_ASYNC_QUEUE) {
1402                 async_types = NFS4_ASYNC_TYPES;
1403                 async_work_cv = &mi->mi_async_work_cv[NFS4_ASYNC_QUEUE];
1404         } else {
1405                 async_types = NFS4_ASYNC_PGOPS_TYPES;
1406                 async_work_cv = &mi->mi_async_work_cv[NFS4_ASYNC_PGOPS_QUEUE];
1407         }
1408 
1409         /*
1410          * Dynamic initialization of nfs_async_timeout to allow nfs to be
1411          * built in an implementation independent manner.
1412          */
1413         if (nfs_async_timeout == -1)
1414                 nfs_async_timeout = NFS_ASYNC_TIMEOUT;
1415 
1416         CALLB_CPR_INIT(&cprinfo, &mi->mi_async_lock, callb_generic_cpr, "nas");
1417 
 
 | 
 
 
   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) 1986, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  24  * Copyright (c) 2017 by Delphix. All rights reserved.
  25  */
  26 
  27 /*
  28  *      Copyright (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  29  *      All Rights Reserved
  30  */
  31 
  32 #include <sys/param.h>
  33 #include <sys/types.h>
  34 #include <sys/systm.h>
  35 #include <sys/thread.h>
  36 #include <sys/t_lock.h>
  37 #include <sys/time.h>
  38 #include <sys/vnode.h>
  39 #include <sys/vfs.h>
  40 #include <sys/errno.h>
  41 #include <sys/buf.h>
  42 #include <sys/stat.h>
  43 #include <sys/cred.h>
 
 
1378  * from the queues in a round-robin fashion.  A number of consecutive
1379  * requests are taken from each queue before moving on to the next
1380  * queue.  This functionality may allow the NFS Version 2 server to do
1381  * write clustering, even if the client is mixing writes and reads
1382  * because it will take multiple write requests from the queue
1383  * before processing any of the other async i/o types.
1384  *
1385  * XXX The nfs4_async_common_start thread is unsafe in the light of the present
1386  * model defined by cpr to suspend the system. Specifically over the
1387  * wire calls are cpr-unsafe. The thread should be reevaluated in
1388  * case of future updates to the cpr model.
1389  */
1390 static void
1391 nfs4_async_common_start(struct vfs *vfsp, int async_queue)
1392 {
1393         struct nfs4_async_reqs *args;
1394         mntinfo4_t *mi = VFTOMI4(vfsp);
1395         clock_t time_left = 1;
1396         callb_cpr_t cprinfo;
1397         int i;
1398         extern volatile int nfs_async_timeout;
1399         int async_types;
1400         kcondvar_t *async_work_cv;
1401 
1402         if (async_queue == NFS4_ASYNC_QUEUE) {
1403                 async_types = NFS4_ASYNC_TYPES;
1404                 async_work_cv = &mi->mi_async_work_cv[NFS4_ASYNC_QUEUE];
1405         } else {
1406                 async_types = NFS4_ASYNC_PGOPS_TYPES;
1407                 async_work_cv = &mi->mi_async_work_cv[NFS4_ASYNC_PGOPS_QUEUE];
1408         }
1409 
1410         /*
1411          * Dynamic initialization of nfs_async_timeout to allow nfs to be
1412          * built in an implementation independent manner.
1413          */
1414         if (nfs_async_timeout == -1)
1415                 nfs_async_timeout = NFS_ASYNC_TIMEOUT;
1416 
1417         CALLB_CPR_INIT(&cprinfo, &mi->mi_async_lock, callb_generic_cpr, "nas");
1418 
 
 |