NFS: EXCHANGE_ID should save the server major and minor ID
[linux-2.6-block.git] / include / linux / nfs_xdr.h
index fee32417539105f9a0184ce6643d40e38f9a1c1b..0872f32c8eef8f5e8b63ae7ab6a0634ecaea2dbf 100644 (file)
@@ -106,14 +106,14 @@ struct nfs_fattr {
                | NFS_ATTR_FATTR_FILEID \
                | NFS_ATTR_FATTR_ATIME \
                | NFS_ATTR_FATTR_MTIME \
-               | NFS_ATTR_FATTR_CTIME)
+               | NFS_ATTR_FATTR_CTIME \
+               | NFS_ATTR_FATTR_CHANGE)
 #define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
                | NFS_ATTR_FATTR_BLOCKS_USED)
 #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
                | NFS_ATTR_FATTR_SPACE_USED)
 #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
-               | NFS_ATTR_FATTR_SPACE_USED \
-               | NFS_ATTR_FATTR_CHANGE)
+               | NFS_ATTR_FATTR_SPACE_USED)
 
 /*
  * Info on the file system
@@ -338,7 +338,6 @@ struct nfs_openargs {
        const struct qstr *     name;
        const struct nfs_server *server;         /* Needed for ID mapping */
        const u32 *             bitmask;
-       const u32 *             dir_bitmask;
        __u32                   claim;
        struct nfs4_sequence_args       seq_args;
 };
@@ -349,7 +348,6 @@ struct nfs_openres {
        struct nfs4_change_info cinfo;
        __u32                   rflags;
        struct nfs_fattr *      f_attr;
-       struct nfs_fattr *      dir_attr;
        struct nfs_seqid *      seqid;
        const struct nfs_server *server;
        fmode_t                 delegation_type;
@@ -542,7 +540,6 @@ struct nfs_commitres {
 struct nfs_removeargs {
        const struct nfs_fh     *fh;
        struct qstr             name;
-       const u32 *             bitmask;
        struct nfs4_sequence_args       seq_args;
 };
 
@@ -561,7 +558,6 @@ struct nfs_renameargs {
        const struct nfs_fh             *new_dir;
        const struct qstr               *old_name;
        const struct qstr               *new_name;
-       const u32                       *bitmask;
        struct nfs4_sequence_args       seq_args;
 };
 
@@ -857,7 +853,6 @@ struct nfs4_create_res {
        struct nfs_fh *                 fh;
        struct nfs_fattr *              fattr;
        struct nfs4_change_info         dir_cinfo;
-       struct nfs_fattr *              dir_fattr;
        struct nfs4_sequence_res        seq_res;
 };
 
@@ -1079,6 +1074,21 @@ struct nfstime4 {
 };
 
 #ifdef CONFIG_NFS_V4_1
+
+struct pnfs_commit_bucket {
+       struct list_head written;
+       struct list_head committing;
+       struct pnfs_layout_segment *wlseg;
+       struct pnfs_layout_segment *clseg;
+};
+
+struct pnfs_ds_commit_info {
+       int nwritten;
+       int ncommitting;
+       int nbuckets;
+       struct pnfs_commit_bucket *buckets;
+};
+
 #define NFS4_EXCHANGE_ID_LEN   (48)
 struct nfs41_exchange_id_args {
        struct nfs_client               *client;
@@ -1088,13 +1098,13 @@ struct nfs41_exchange_id_args {
        u32                             flags;
 };
 
-struct server_owner {
+struct nfs41_server_owner {
        uint64_t                        minor_id;
        uint32_t                        major_id_sz;
        char                            major_id[NFS4_OPAQUE_LIMIT];
 };
 
-struct server_scope {
+struct nfs41_server_scope {
        uint32_t                        server_scope_sz;
        char                            server_scope[NFS4_OPAQUE_LIMIT];
 };
@@ -1108,7 +1118,8 @@ struct nfs41_impl_id {
 struct nfs41_exchange_id_res {
        struct nfs_client               *client;
        u32                             flags;
-       struct server_scope             *server_scope;
+       struct nfs41_server_owner       *server_owner;
+       struct nfs41_server_scope       *server_scope;
        struct nfs41_impl_id            *impl_id;
 };
 
@@ -1161,36 +1172,65 @@ struct nfs41_free_stateid_res {
        struct nfs4_sequence_res        seq_res;
 };
 
+#else
+
+struct pnfs_ds_commit_info {
+};
+
 #endif /* CONFIG_NFS_V4_1 */
 
 struct nfs_page;
 
 #define NFS_PAGEVEC_SIZE       (8U)
 
+struct nfs_page_array {
+       struct page             **pagevec;
+       unsigned int            npages;         /* Max length of pagevec */
+       struct page             *page_array[NFS_PAGEVEC_SIZE];
+};
+
 struct nfs_read_data {
        struct nfs_pgio_header  *header;
        struct list_head        list;
        struct rpc_task         task;
        struct nfs_fattr        fattr;  /* fattr storage */
-       struct page             **pagevec;
-       unsigned int            npages; /* Max length of pagevec */
        struct nfs_readargs args;
        struct nfs_readres  res;
        unsigned long           timestamp;      /* For lease renewal */
        int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
        __u64                   mds_offset;
-       struct page             *page_array[NFS_PAGEVEC_SIZE];
+       struct nfs_page_array   pages;
        struct nfs_client       *ds_clp;        /* pNFS data server */
 };
 
+/* used as flag bits in nfs_pgio_header */
+enum {
+       NFS_IOHDR_ERROR = 0,
+       NFS_IOHDR_EOF,
+       NFS_IOHDR_REDO,
+       NFS_IOHDR_NEED_COMMIT,
+       NFS_IOHDR_NEED_RESCHED,
+};
+
 struct nfs_pgio_header {
        struct inode            *inode;
        struct rpc_cred         *cred;
        struct list_head        pages;
+       struct list_head        rpc_list;
+       atomic_t                refcnt;
        struct nfs_page         *req;
        struct pnfs_layout_segment *lseg;
+       loff_t                  io_start;
        const struct rpc_call_ops *mds_ops;
+       void (*release) (struct nfs_pgio_header *hdr);
+       const struct nfs_pgio_completion_ops *completion_ops;
+       struct nfs_direct_req   *dreq;
+       spinlock_t              lock;
+       /* fields protected by lock */
        int                     pnfs_error;
+       int                     error;          /* merge with pnfs_error */
+       unsigned long           good_bytes;     /* boundary of good data */
+       unsigned long           flags;
 };
 
 struct nfs_read_header {
@@ -1198,22 +1238,18 @@ struct nfs_read_header {
        struct nfs_read_data    rpc_data;
 };
 
-struct nfs_direct_req;
-
 struct nfs_write_data {
        struct nfs_pgio_header  *header;
        struct list_head        list;
        struct rpc_task         task;
        struct nfs_fattr        fattr;
        struct nfs_writeverf    verf;
-       struct page             **pagevec;
-       unsigned int            npages;         /* Max length of pagevec */
        struct nfs_writeargs    args;           /* argument struct */
        struct nfs_writeres     res;            /* result struct */
        unsigned long           timestamp;      /* For lease renewal */
        int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
        __u64                   mds_offset;     /* Filelayout dense stripe */
-       struct page             *page_array[NFS_PAGEVEC_SIZE];
+       struct nfs_page_array   pages;
        struct nfs_client       *ds_clp;        /* pNFS data server */
 };
 
@@ -1222,6 +1258,27 @@ struct nfs_write_header {
        struct nfs_write_data   rpc_data;
 };
 
+struct nfs_mds_commit_info {
+       atomic_t rpcs_out;
+       unsigned long           ncommit;
+       struct list_head        list;
+};
+
+struct nfs_commit_data;
+struct nfs_inode;
+struct nfs_commit_completion_ops {
+       void (*error_cleanup) (struct nfs_inode *nfsi);
+       void (*completion) (struct nfs_commit_data *data);
+};
+
+struct nfs_commit_info {
+       spinlock_t                      *lock;
+       struct nfs_mds_commit_info      *mds;
+       struct pnfs_ds_commit_info      *ds;
+       struct nfs_direct_req           *dreq;  /* O_DIRECT request */
+       const struct nfs_commit_completion_ops *completion_ops;
+};
+
 struct nfs_commit_data {
        struct rpc_task         task;
        struct inode            *inode;
@@ -1238,9 +1295,16 @@ struct nfs_commit_data {
        struct nfs_client       *ds_clp;        /* pNFS data server */
        int                     ds_commit_index;
        const struct rpc_call_ops *mds_ops;
+       const struct nfs_commit_completion_ops *completion_ops;
        int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
 };
 
+struct nfs_pgio_completion_ops {
+       void    (*error_cleanup)(struct list_head *head);
+       void    (*init_hdr)(struct nfs_pgio_header *hdr);
+       void    (*completion)(struct nfs_pgio_header *hdr);
+};
+
 struct nfs_unlinkdata {
        struct hlist_node list;
        struct nfs_removeargs args;
@@ -1278,11 +1342,13 @@ struct nfs_rpc_ops {
 
        int     (*getroot) (struct nfs_server *, struct nfs_fh *,
                            struct nfs_fsinfo *);
+       struct vfsmount *(*submount) (struct nfs_server *, struct dentry *,
+                                     struct nfs_fh *, struct nfs_fattr *);
        int     (*getattr) (struct nfs_server *, struct nfs_fh *,
                            struct nfs_fattr *);
        int     (*setattr) (struct dentry *, struct nfs_fattr *,
                            struct iattr *);
-       int     (*lookup)  (struct rpc_clnt *clnt, struct inode *, struct qstr *,
+       int     (*lookup)  (struct inode *, struct qstr *,
                            struct nfs_fh *, struct nfs_fattr *);
        int     (*access)  (struct inode *, struct nfs_access_entry *);
        int     (*readlink)(struct inode *, struct page *, unsigned int,
@@ -1332,9 +1398,9 @@ struct nfs_rpc_ops {
                                struct nfs_open_context *ctx,
                                int open_flags,
                                struct iattr *iattr);
-       int     (*init_client) (struct nfs_client *, const struct rpc_timeout *,
-                               const char *, rpc_authflavor_t, int);
-       int     (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *);
+       struct nfs_client *
+               (*init_client) (struct nfs_client *, const struct rpc_timeout *,
+                               const char *, rpc_authflavor_t);
 };
 
 /*