nfsd41: replace page based DRC with buffer based DRC
[safe/jmp/linux-2.6] / include / linux / nfsd / state.h
index 836c0d6..70ef5f4 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/kref.h>
 #include <linux/sunrpc/clnt.h>
 
-#define NFS4_OPAQUE_LIMIT 1024
 typedef struct {
        u32             cl_boot;
        u32             cl_id;
@@ -61,15 +60,6 @@ typedef struct {
 #define si_stateownerid   si_opaque.so_stateownerid
 #define si_fileid         si_opaque.so_fileid
 
-
-struct nfs4_cb_recall {
-       u32                     cbr_ident;
-       int                     cbr_trunc;
-       stateid_t               cbr_stateid;
-       struct knfsd_fh         cbr_fh;
-       struct nfs4_delegation  *cbr_dp;
-};
-
 struct nfs4_delegation {
        struct list_head        dl_perfile;
        struct list_head        dl_perclnt;
@@ -81,45 +71,76 @@ struct nfs4_delegation {
        struct file             *dl_vfs_file;
        u32                     dl_type;
        time_t                  dl_time;
-       struct nfs4_cb_recall   dl_recall;
+/* For recall: */
+       u32                     dl_ident;
+       stateid_t               dl_stateid;
+       struct knfsd_fh         dl_fh;
+       int                     dl_retries;
 };
 
-#define dl_stateid      dl_recall.cbr_stateid
-#define dl_fh           dl_recall.cbr_fh
-
 /* client delegation callback info */
-struct nfs4_callback {
+struct nfs4_cb_conn {
        /* SETCLIENTID info */
-       u32                     cb_addr;
-       unsigned short          cb_port;
+       struct sockaddr_storage cb_addr;
+       size_t                  cb_addrlen;
        u32                     cb_prog;
-       u32                     cb_ident;
+       u32                     cb_minorversion;
+       u32                     cb_ident;       /* minorversion 0 only */
        /* RPC client info */
        atomic_t                cb_set;     /* successful CB_NULL call */
        struct rpc_clnt *       cb_client;
+       struct rpc_cred *       cb_cred;
 };
 
-/* Maximum number of slots per session. 128 is useful for long haul TCP */
-#define NFSD_MAX_SLOTS_PER_SESSION     128
-/* Maximum number of pages per slot cache entry */
-#define NFSD_PAGES_PER_SLOT    1
+/* Maximum number of slots per session. 160 is useful for long haul TCP */
+#define NFSD_MAX_SLOTS_PER_SESSION     160
 /* Maximum number of operations per session compound */
 #define NFSD_MAX_OPS_PER_COMPOUND      16
+/* Maximum  session per slot cache size */
+#define NFSD_SLOT_CACHE_SIZE           1024
+/* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */
+#define NFSD_CACHE_SIZE_SLOTS_PER_SESSION      32
+#define NFSD_MAX_MEM_PER_SESSION  \
+               (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE)
+
+struct nfsd4_slot {
+       bool    sl_inuse;
+       bool    sl_cachethis;
+       u16     sl_opcnt;
+       u32     sl_seqid;
+       __be32  sl_status;
+       u32     sl_datalen;
+       char    sl_data[];
+};
 
-struct nfsd4_cache_entry {
-       __be32          ce_status;
-       struct kvec     ce_datav; /* encoded NFSv4.1 data in rq_res.head[0] */
-       struct page     *ce_respages[NFSD_PAGES_PER_SLOT + 1];
-       int             ce_cachethis;
-       short           ce_resused;
-       int             ce_opcnt;
-       int             ce_rpchdrlen;
+struct nfsd4_channel_attrs {
+       u32             headerpadsz;
+       u32             maxreq_sz;
+       u32             maxresp_sz;
+       u32             maxresp_cached;
+       u32             maxops;
+       u32             maxreqs;
+       u32             nr_rdma_attrs;
+       u32             rdma_attrs;
 };
 
-struct nfsd4_slot {
-       bool                            sl_inuse;
+struct nfsd4_create_session {
+       clientid_t                      clientid;
+       struct nfs4_sessionid           sessionid;
+       u32                             seqid;
+       u32                             flags;
+       struct nfsd4_channel_attrs      fore_channel;
+       struct nfsd4_channel_attrs      back_channel;
+       u32                             callback_prog;
+       u32                             uid;
+       u32                             gid;
+};
+
+/* The single slot clientid cache structure */
+struct nfsd4_clid_slot {
        u32                             sl_seqid;
-       struct nfsd4_cache_entry        sl_cache_entry;
+       __be32                          sl_status;
+       struct nfsd4_create_session     sl_cr_ses;
 };
 
 struct nfsd4_session {
@@ -129,12 +150,9 @@ struct nfsd4_session {
        u32                     se_flags;
        struct nfs4_client      *se_client;     /* for expire_client */
        struct nfs4_sessionid   se_sessionid;
-       u32                     se_fmaxreq_sz;
-       u32                     se_fmaxresp_sz;
-       u32                     se_fmaxresp_cached;
-       u32                     se_fmaxops;
-       u32                     se_fnumslots;
-       struct nfsd4_slot       se_slots[];     /* forward channel slots */
+       struct nfsd4_channel_attrs se_fchannel;
+       struct nfsd4_channel_attrs se_bchannel;
+       struct nfsd4_slot       *se_slots[];    /* forward channel slots */
 };
 
 static inline void
@@ -179,19 +197,19 @@ struct nfs4_client {
        char                    cl_recdir[HEXDIR_LEN]; /* recovery dir */
        nfs4_verifier           cl_verifier;    /* generated by client */
        time_t                  cl_time;        /* time of last lease renewal */
-       __be32                  cl_addr;        /* client ipaddress */
+       struct sockaddr_storage cl_addr;        /* client ipaddress */
        u32                     cl_flavor;      /* setclientid pseudoflavor */
        char                    *cl_principal;  /* setclientid principal name */
        struct svc_cred         cl_cred;        /* setclientid principal */
        clientid_t              cl_clientid;    /* generated by server */
        nfs4_verifier           cl_confirm;     /* generated by server */
-       struct nfs4_callback    cl_callback;    /* callback info */
+       struct nfs4_cb_conn     cl_cb_conn;     /* callback info */
        atomic_t                cl_count;       /* ref count */
        u32                     cl_firststate;  /* recovery dir creation */
 
        /* for nfs41 */
        struct list_head        cl_sessions;
-       struct nfsd4_slot       cl_slot;        /* create_session slot */
+       struct nfsd4_clid_slot  cl_cs_slot;     /* create_session slot */
        u32                     cl_exchange_flags;
        struct nfs4_sessionid   cl_sessionid;
 };
@@ -320,6 +338,7 @@ struct nfs4_stateid {
 };
 
 /* flags for preprocess_seqid_op() */
+#define HAS_SESSION             0x00000001
 #define CONFIRM                 0x00000002
 #define OPEN_STATE              0x00000004
 #define LOCK_STATE              0x00000008