svn commit: r323775 - in head/sys/fs: nfs nfsclient

Rick Macklem rmacklem at FreeBSD.org
Tue Sep 19 20:18:43 UTC 2017


Author: rmacklem
Date: Tue Sep 19 20:18:41 2017
New Revision: 323775
URL: https://svnweb.freebsd.org/changeset/base/323775

Log:
  Simplify nfsrpc_layoutcommit() args.
  
  Simplify nfsrpc_layoutcommit() args. in preparation for the addition
  of Flex File layout support, since it also uses a 0 length field.

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clstate.c

Modified: head/sys/fs/nfs/nfs_var.h
==============================================================================
--- head/sys/fs/nfs/nfs_var.h	Tue Sep 19 20:09:58 2017	(r323774)
+++ head/sys/fs/nfs/nfs_var.h	Tue Sep 19 20:18:41 2017	(r323775)
@@ -484,8 +484,8 @@ int nfsrpc_layoutget(struct nfsmount *, uint8_t *, int
 int nfsrpc_getdeviceinfo(struct nfsmount *, uint8_t *, int, uint32_t *,
     struct nfscldevinfo **, struct ucred *, NFSPROC_T *);
 int nfsrpc_layoutcommit(struct nfsmount *, uint8_t *, int, int,
-    uint64_t, uint64_t, uint64_t, nfsv4stateid_t *, int, int, uint8_t *,
-    struct ucred *, NFSPROC_T *, void *);
+    uint64_t, uint64_t, uint64_t, nfsv4stateid_t *, int, struct ucred *,
+    NFSPROC_T *, void *);
 int nfsrpc_layoutreturn(struct nfsmount *, uint8_t *, int, int, int, uint32_t,
     int, uint64_t, uint64_t, nfsv4stateid_t *, int, uint32_t *, struct ucred *,
     NFSPROC_T *, void *);

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clrpcops.c	Tue Sep 19 20:09:58 2017	(r323774)
+++ head/sys/fs/nfsclient/nfs_clrpcops.c	Tue Sep 19 20:18:41 2017	(r323775)
@@ -5030,13 +5030,11 @@ nfsmout:
 int
 nfsrpc_layoutcommit(struct nfsmount *nmp, uint8_t *fh, int fhlen, int reclaim,
     uint64_t off, uint64_t len, uint64_t lastbyte, nfsv4stateid_t *stateidp,
-    int layouttype, int layoutupdatecnt, uint8_t *layp, struct ucred *cred,
-    NFSPROC_T *p, void *stuff)
+    int layouttype, struct ucred *cred, NFSPROC_T *p, void *stuff)
 {
 	uint32_t *tl;
 	struct nfsrv_descript nfsd, *nd = &nfsd;
-	int error, outcnt, i;
-	uint8_t *cp;
+	int error;
 
 	nfscl_reqstart(nd, NFSPROC_LAYOUTCOMMIT, nmp, fh, fhlen, NULL, NULL);
 	NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED + 3 * NFSX_HYPER +
@@ -5062,17 +5060,8 @@ nfsrpc_layoutcommit(struct nfsmount *nmp, uint8_t *fh,
 	tl += 2;
 	*tl++ = newnfs_false;
 	*tl++ = txdr_unsigned(layouttype);
-	*tl = txdr_unsigned(layoutupdatecnt);
-	if (layoutupdatecnt > 0) {
-		KASSERT(layouttype != NFSLAYOUT_NFSV4_1_FILES,
-		    ("Must be nil for Files Layout"));
-		outcnt = NFSM_RNDUP(layoutupdatecnt);
-		NFSM_BUILD(cp, uint8_t *, outcnt);
-		NFSBCOPY(layp, cp, layoutupdatecnt);
-		cp += layoutupdatecnt;
-		for (i = 0; i < (outcnt - layoutupdatecnt); i++)
-			*cp++ = 0x0;
-	}
+	/* All supported layouts are 0 length. */
+	*tl = txdr_unsigned(0);
 	nd->nd_flag |= ND_USEGSSNAME;
 	error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred,
 	    NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL);

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clstate.c	Tue Sep 19 20:09:58 2017	(r323774)
+++ head/sys/fs/nfsclient/nfs_clstate.c	Tue Sep 19 20:18:41 2017	(r323775)
@@ -5256,7 +5256,7 @@ nfscl_dolayoutcommit(struct nfsmount *nmp, struct nfsc
 			error = nfsrpc_layoutcommit(nmp, lyp->nfsly_fh,
 			    lyp->nfsly_fhlen, 0, flp->nfsfl_off, len,
 			    lyp->nfsly_lastbyte, &lyp->nfsly_stateid,
-			    NFSLAYOUT_NFSV4_1_FILES, 0, NULL, cred, p, NULL);
+			    NFSLAYOUT_NFSV4_1_FILES, cred, p, NULL);
 			NFSCL_DEBUG(4, "layoutcommit err=%d\n", error);
 			if (error == NFSERR_NOTSUPP) {
 				/* If not supported, don't bother doing it. */


More information about the svn-src-all mailing list