From owner-svn-src-projects@freebsd.org Fri Apr 28 00:10:28 2017 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44D64D4D05A for ; Fri, 28 Apr 2017 00:10:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECCECA48; Fri, 28 Apr 2017 00:10:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3S0AQgs041213; Fri, 28 Apr 2017 00:10:26 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3S0AQAb041212; Fri, 28 Apr 2017 00:10:26 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704280010.v3S0AQAb041212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 28 Apr 2017 00:10:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r317536 - projects/pnfs-planb-server/sys/fs/nfs X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 00:10:28 -0000 Author: rmacklem Date: Fri Apr 28 00:10:26 2017 New Revision: 317536 URL: https://svnweb.freebsd.org/changeset/base/317536 Log: Update nfsrvstate.h to include the pNFS server code. Modified: projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h Modified: projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h Thu Apr 27 23:52:14 2017 (r317535) +++ projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h Fri Apr 28 00:10:26 2017 (r317536) @@ -29,6 +29,7 @@ #ifndef _NFS_NFSRVSTATE_H_ #define _NFS_NFSRVSTATE_H_ +#if defined(_KERNEL) || defined(KERNEL) /* * Definitions for NFS V4 server state handling. */ @@ -44,6 +45,8 @@ LIST_HEAD(nfslockhead, nfslock); LIST_HEAD(nfslockhashhead, nfslockfile); LIST_HEAD(nfssessionhead, nfsdsession); LIST_HEAD(nfssessionhashhead, nfsdsession); +LIST_HEAD(nfslayouthead, nfslayout); +SLIST_HEAD(nfsdsdirhead, nfsdsdir); /* * List head for nfsusrgrp. @@ -72,6 +75,13 @@ struct nfssessionhash { #define NFSSESSIONHASH(f) \ (&nfssessionhash[nfsrv_hashsessionid(f) % nfsrv_sessionhashsize]) +struct nfslayouthash { + struct mtx mtx; + struct nfslayouthead list; +}; +#define NFSLAYOUTHASH(f) \ + (&nfslayouthash[nfsrv_hashfh(f) % nfsrv_layouthashsize]) + /* * Client server structure for V4. It is doubly linked into two lists. * The first is a hash table based on the clientid and the second is a @@ -110,6 +120,21 @@ struct nfsclient { #define CLOPS_RENEWOP 0x0004 /* + * Structure for NFSv4.1 Layouts. + * Malloc'd to correct size for the lay_xdr. + */ +struct nfslayout { + LIST_ENTRY(nfslayout) lay_list; + nfsv4stateid_t lay_stateid; + nfsquad_t lay_clientid; + fhandle_t lay_fh; + uint16_t lay_layoutlen; + uint8_t lay_read; + uint8_t lay_rw; + char lay_xdr[0]; +}; + +/* * Structure for an NFSv4.1 session. * Locking rules for this structure. * To add/delete one of these structures from the lists, you must lock @@ -153,6 +178,7 @@ struct nfsdsession { * - open file structures chained off an open_owner structure * - lock_owner structures chained off an open file structure * - delegated file structures chained off of nfsclient and nfslockfile + * - pNFS layouts chained off of nfsclient and nfslockfile * - the ls_list field is used for the chain it is in * - the ls_head structure is used to chain off the sibling structure * (it is a union between an nfsstate and nfslock structure head) @@ -186,8 +212,9 @@ struct nfsstate { struct nfslockfile *ls_lfp; /* Back pointer */ struct nfsrvcache *ls_op; /* Op cache reference */ struct nfsclient *ls_clp; /* Back pointer */ - u_short ls_ownerlen; /* Length of ls_owner */ + u_int32_t ls_ownerlen; /* Length of ls_owner */ u_char ls_owner[1]; /* malloc'd the correct size */ + /* Must be uint32_t * aligned */ }; #define ls_lock ls_head.lock #define ls_open ls_head.open @@ -199,6 +226,8 @@ struct nfsstate { #define ls_delegtime ls_un.deleg.expiry #define ls_delegtimelimit ls_un.deleg.limit #define ls_compref ls_un.deleg.compref +#define ls_layout ls_owner +#define ls_layoutlen ls_ownerlen /* * Nfs lock structure. @@ -249,6 +278,7 @@ struct nfsrollback { struct nfslockfile { LIST_HEAD(, nfsstate) lf_open; /* Open list */ LIST_HEAD(, nfsstate) lf_deleg; /* Delegation list */ + LIST_HEAD(, nfsstate) lf_layout; /* Layout list */ LIST_HEAD(, nfslock) lf_lock; /* Lock list */ LIST_HEAD(, nfslock) lf_locallock; /* Local lock list */ LIST_HEAD(, nfsrollback) lf_rollback; /* Local lock rollback list */ @@ -288,9 +318,56 @@ struct nfsf_rec { u_int32_t numboots; /* Number of boottimes */ }; -#if defined(_KERNEL) || defined(KERNEL) void nfsrv_cleanclient(struct nfsclient *, NFSPROC_T *); void nfsrv_freedeleglist(struct nfsstatehead *); -#endif + +/* + * This structure is used to create the list of device info entries for + * a GetDeviceInfo operation and stores the DS server info. + * The nfsdev_addrandhost field has the fully qualified host domain name + * followed by the network address in XDR. + * It is allocated with nfsrv_dsdirsize nfsdev_dsdir[] entries. + */ +struct nfsdevice { + TAILQ_ENTRY(nfsdevice) nfsdev_list; + vnode_t nfsdev_dvp; + struct nfsmount *nfsdev_nmp; + char nfsdev_deviceid[NFSX_V4DEVICEID]; + uint16_t nfsdev_hostnamelen; + uint16_t nfsdev_fileaddrlen; + char *nfsdev_fileaddr; + char *nfsdev_host; + uint32_t nfsdev_nextdir; + vnode_t nfsdev_dsdir[0]; +}; +TAILQ_HEAD(nfsdevicehead, nfsdevice); + +/* + * This structure holds the va_size, va_filerev and va_mtime for the DS + * file and is stored in the metadata file's extended attribute pnfsd.dsattr. + */ +struct pnfsdsattr { + uint64_t dsa_filerev; + uint64_t dsa_size; + struct timespec dsa_mtime; +}; + +#endif /* defined(_KERNEL) || defined(KERNEL) */ + +/* + * This structure holds the information about the DS file and is stored + * in the metadata file's extended attribute called pnfsd.dsfile. + * dsf_nam[0] is defined as the actual length of sa_len for the addr. + */ +struct pnfsdsfile { + fhandle_t dsf_fh; + uint32_t dsf_dir; + union { + struct sockaddr_in sin; + struct sockaddr_in6 sin6; + } dsf_nam; +}; +#define dsf_sin dsf_nam.sin +#define dsf_sin6 dsf_nam.sin6 #endif /* _NFS_NFSRVSTATE_H_ */