Author: rmacklem
Date: Sat Jun  2 00:11:26 2018
New Revision: 334511
URL: https://svnweb.freebsd.org/changeset/base/334511

Log:
  Fix the default number of threads for Flex File layout pNFS client I/O.
  
  The intent was that the default would be based on number of CPUs, but the
  code disabled using taskqueue() by default.
  This code is only executed when mounting a NFSv4.1 server that supports the
  Flexible File layout for pNFS and, since such servers are rare, this change
  shouldn't result in a POLA violation.
  (The FreeBSD pNFS server is still a project and the only other one that
   uses Flexible File layout is being developed by Primary Data and I don't
   know if they have even shipped any to customers yet.)
  Found while testing the pNFS server.

Modified:
  head/sys/fs/nfs/nfs_commonport.c
  head/sys/fs/nfsclient/nfs_clrpcops.c

Modified: head/sys/fs/nfs/nfs_commonport.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonport.c    Sat Jun  2 00:02:27 2018        
(r334510)
+++ head/sys/fs/nfs/nfs_commonport.c    Sat Jun  2 00:11:26 2018        
(r334511)
@@ -90,7 +90,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, debuglevel, CTLFLAG_RW,
     0, "Debug level for NFS client");
 SYSCTL_INT(_vfs_nfs, OID_AUTO, userhashsize, CTLFLAG_RDTUN, &nfsrv_lughashsize,
     0, "Size of hash tables for uid/name mapping");
-int nfs_pnfsiothreads = 0;
+int nfs_pnfsiothreads = -1;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, pnfsiothreads, CTLFLAG_RW, &nfs_pnfsiothreads,
     0, "Number of pNFS mirror I/O threads");
 
@@ -723,6 +723,8 @@ nfs_pnfsio(task_fn_t *func, void *context)
        pio = (struct pnfsio *)context;
        if (pnfsioq == NULL) {
                if (nfs_pnfsiothreads == 0)
+                       return (EPERM);
+               if (nfs_pnfsiothreads < 0)
                        nfs_pnfsiothreads = mp_ncpus * 4;
                pnfsioq = taskqueue_create("pnfsioq", M_WAITOK,
                    taskqueue_thread_enqueue, &pnfsioq);

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clrpcops.c        Sat Jun  2 00:02:27 2018        
(r334510)
+++ head/sys/fs/nfsclient/nfs_clrpcops.c        Sat Jun  2 00:11:26 2018        
(r334511)
@@ -6436,7 +6436,7 @@ nfsio_writedsmir(vnode_t vp, int *iomode, int *must_co
        drpc->p = p;
        drpc->inprog = 0;
        ret = EIO;
-       if (nfs_pnfsiothreads > 0) {
+       if (nfs_pnfsiothreads != 0) {
                ret = nfs_pnfsio(start_writedsmir, drpc);
                NFSCL_DEBUG(4, "nfsio_writedsmir: nfs_pnfsio=%d\n", ret);
        }
@@ -6615,7 +6615,7 @@ nfsio_commitds(vnode_t vp, uint64_t offset, int cnt, s
        drpc->p = p;
        drpc->inprog = 0;
        ret = EIO;
-       if (nfs_pnfsiothreads > 0) {
+       if (nfs_pnfsiothreads != 0) {
                ret = nfs_pnfsio(start_commitds, drpc);
                NFSCL_DEBUG(4, "nfsio_commitds: nfs_pnfsio=%d\n", ret);
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to