svn commit: r352049 - in projects/nfsv42/sys/fs: nfs nfsclient nfsserver
Rick Macklem
rmacklem at FreeBSD.org
Sun Sep 8 21:43:21 UTC 2019
Author: rmacklem
Date: Sun Sep 8 21:43:19 2019
New Revision: 352049
URL: https://svnweb.freebsd.org/changeset/base/352049
Log:
Move vfs.nfsd.maxcopyrange to vfs.nfs.maxcopyrange so client can use it as well.
This patch makes the NFSv4.2 client use vfs.nfs.maxcopyrange as a limit for
the size of a Copy RPC similar to the NFSv4.2 server.
This limit is intended to make synchronous Copy operations complete in less
than 1 second so that the RPC round trip time remains below 1 second.
I plan on implementing asynchronous Copy for the NFSv4.2 server soon,
since that is what the Linux client uses for large Copies.
Modified:
projects/nfsv42/sys/fs/nfs/nfs_commonsubs.c
projects/nfsv42/sys/fs/nfsclient/nfs_clrpcops.c
projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c
Modified: projects/nfsv42/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- projects/nfsv42/sys/fs/nfs/nfs_commonsubs.c Sun Sep 8 21:37:52 2019 (r352048)
+++ projects/nfsv42/sys/fs/nfs/nfs_commonsubs.c Sun Sep 8 21:43:19 2019 (r352049)
@@ -90,6 +90,10 @@ int nfsrv_maxpnfsmirror = 1;
SYSCTL_INT(_vfs_nfs, OID_AUTO, pnfsmirror, CTLFLAG_RD,
&nfsrv_maxpnfsmirror, 0, "Mirror level for pNFS service");
+int nfs_maxcopyrange = 10 * 1024 * 1024;
+SYSCTL_INT(_vfs_nfs, OID_AUTO, maxcopyrange, CTLFLAG_RW,
+ &nfs_maxcopyrange, 0, "Max size of a Copy so RPC times reasonable");
+
/*
* This array of structures indicates, for V4:
* retfh - which of 3 types of calling args are used
Modified: projects/nfsv42/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- projects/nfsv42/sys/fs/nfsclient/nfs_clrpcops.c Sun Sep 8 21:37:52 2019 (r352048)
+++ projects/nfsv42/sys/fs/nfsclient/nfs_clrpcops.c Sun Sep 8 21:43:19 2019 (r352049)
@@ -75,6 +75,7 @@ extern char nfsv4_callbackaddr[INET6_ADDRSTRLEN];
extern int nfscl_debuglevel;
extern int nfs_pnfsiothreads;
extern u_long sb_max_adj;
+extern int nfs_maxcopyrange;
NFSCLSTATEMUTEX;
int nfstest_outofseq = 0;
int nfscl_assumeposixlocks = 1;
@@ -8060,6 +8061,8 @@ nfsrpc_copyrpc(vnode_t invp, off_t inoff, vnode_t outv
*commitp = NFSWRITE_UNSTABLE;
len = *lenp;
*lenp = 0;
+ if (len > nfs_maxcopyrange)
+ len = nfs_maxcopyrange;
NFSCL_REQSTART(nd, NFSPROC_COPY, invp);
NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
*tl = txdr_unsigned(NFSV4OP_GETATTR);
Modified: projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c Sun Sep 8 21:37:52 2019 (r352048)
+++ projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c Sun Sep 8 21:43:19 2019 (r352049)
@@ -67,6 +67,7 @@ extern int nfsd_debuglevel;
extern u_long sb_max_adj;
extern int nfsrv_pnfsatime;
extern int nfsrv_maxpnfsmirror;
+extern int nfs_maxcopyrange;
#endif /* !APPLEKEXT */
static int nfs_async = 0;
@@ -76,9 +77,6 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, async, CTLFLAG_RW, &nf
extern int nfsrv_doflexfile;
SYSCTL_INT(_vfs_nfsd, OID_AUTO, default_flexfile, CTLFLAG_RW,
&nfsrv_doflexfile, 0, "Make Flex File Layout the default for pNFS");
-static int nfsrv_maxcopyrange = 10 * 1024 * 1024;
-SYSCTL_INT(_vfs_nfsd, OID_AUTO, maxcopyrange, CTLFLAG_RW,
- &nfsrv_maxcopyrange, 0, "Max size of a Copy so RPC times reasonable");
/*
* This list defines the GSS mechanisms supported.
@@ -5338,12 +5336,12 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __un
}
/*
- * Do the actual copy to an upper limit of vfs.nfsd.maxcopyrange.
+ * Do the actual copy to an upper limit of vfs.nfs.maxcopyrange.
* This limit is applied to ensure that the RPC replies in a
* reasonable time.
*/
- if (len > nfsrv_maxcopyrange)
- xfer = nfsrv_maxcopyrange;
+ if (len > nfs_maxcopyrange)
+ xfer = nfs_maxcopyrange;
else
xfer = len;
nd->nd_repstat = vn_copy_file_range(vp, &inoff, tovp, &outoff, &xfer, 0,
More information about the svn-src-projects
mailing list