svn commit: r317536 - projects/pnfs-planb-server/sys/fs/nfs
Rick Macklem
rmacklem at FreeBSD.org
Fri Apr 28 00:10:28 UTC 2017
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_ */
More information about the svn-src-projects
mailing list