aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfs_xdr.h
diff options
context:
space:
mode:
authorFred Isaman <iisaman@netapp.com>2012-04-20 14:47:44 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-04-27 14:10:37 -0400
commitcd841605f7a721878d8a2d1362484723d8abf569 (patch)
treeb5c37db575cd545a183577249909e042fe38d646 /include/linux/nfs_xdr.h
parentb5542849764aa56fd3f05c0041195b637b9d2ac2 (diff)
NFS: create common nfs_pgio_header for both read and write
In order to avoid duplicating all the data in nfs_read_data whenever we split it up into multiple RPC calls (either due to a short read result or due to rsize < PAGE_SIZE), we split out the bits that are the same per RPC call into a separate "header" structure. The goal this patch moves towards is to have a single header refcounted by several rpc_data structures. Thus, want to always refer from rpc_data to the header, and not the other way. This patch comes close to that ideal, but the directio code currently needs some special casing, isolated in the nfs_direct_[read_write]hdr_release() functions. This will be dealt with in a future patch. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include/linux/nfs_xdr.h')
-rw-r--r--include/linux/nfs_xdr.h48
1 files changed, 27 insertions, 21 deletions
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 8fb036a0d489..fee324175391 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1168,52 +1168,58 @@ struct nfs_page;
1168#define NFS_PAGEVEC_SIZE (8U) 1168#define NFS_PAGEVEC_SIZE (8U)
1169 1169
1170struct nfs_read_data { 1170struct nfs_read_data {
1171 struct nfs_pgio_header *header;
1172 struct list_head list;
1171 struct rpc_task task; 1173 struct rpc_task task;
1172 struct inode *inode;
1173 struct rpc_cred *cred;
1174 struct nfs_fattr fattr; /* fattr storage */ 1174 struct nfs_fattr fattr; /* fattr storage */
1175 struct list_head pages; /* Coalesced read requests */
1176 struct list_head list; /* lists of struct nfs_read_data */
1177 struct nfs_page *req; /* multi ops per nfs_page */
1178 struct page **pagevec; 1175 struct page **pagevec;
1179 unsigned int npages; /* Max length of pagevec */ 1176 unsigned int npages; /* Max length of pagevec */
1180 struct nfs_readargs args; 1177 struct nfs_readargs args;
1181 struct nfs_readres res; 1178 struct nfs_readres res;
1182 unsigned long timestamp; /* For lease renewal */ 1179 unsigned long timestamp; /* For lease renewal */
1183 struct pnfs_layout_segment *lseg;
1184 struct nfs_client *ds_clp; /* pNFS data server */
1185 const struct rpc_call_ops *mds_ops;
1186 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data); 1180 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
1187 __u64 mds_offset; 1181 __u64 mds_offset;
1188 int pnfs_error;
1189 struct page *page_array[NFS_PAGEVEC_SIZE]; 1182 struct page *page_array[NFS_PAGEVEC_SIZE];
1183 struct nfs_client *ds_clp; /* pNFS data server */
1184};
1185
1186struct nfs_pgio_header {
1187 struct inode *inode;
1188 struct rpc_cred *cred;
1189 struct list_head pages;
1190 struct nfs_page *req;
1191 struct pnfs_layout_segment *lseg;
1192 const struct rpc_call_ops *mds_ops;
1193 int pnfs_error;
1194};
1195
1196struct nfs_read_header {
1197 struct nfs_pgio_header header;
1198 struct nfs_read_data rpc_data;
1190}; 1199};
1191 1200
1192struct nfs_direct_req; 1201struct nfs_direct_req;
1193 1202
1194struct nfs_write_data { 1203struct nfs_write_data {
1204 struct nfs_pgio_header *header;
1205 struct list_head list;
1195 struct rpc_task task; 1206 struct rpc_task task;
1196 struct inode *inode;
1197 struct rpc_cred *cred;
1198 struct nfs_fattr fattr; 1207 struct nfs_fattr fattr;
1199 struct nfs_writeverf verf; 1208 struct nfs_writeverf verf;
1200 struct list_head pages; /* Coalesced requests we wish to flush */
1201 struct list_head list; /* lists of struct nfs_write_data */
1202 struct nfs_page *req; /* multi ops per nfs_page */
1203 struct page **pagevec; 1209 struct page **pagevec;
1204 unsigned int npages; /* Max length of pagevec */ 1210 unsigned int npages; /* Max length of pagevec */
1205 struct nfs_writeargs args; /* argument struct */ 1211 struct nfs_writeargs args; /* argument struct */
1206 struct nfs_writeres res; /* result struct */ 1212 struct nfs_writeres res; /* result struct */
1207 struct pnfs_layout_segment *lseg;
1208 struct nfs_client *ds_clp; /* pNFS data server */
1209 const struct rpc_call_ops *mds_ops;
1210 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
1211#ifdef CONFIG_NFS_V4
1212 unsigned long timestamp; /* For lease renewal */ 1213 unsigned long timestamp; /* For lease renewal */
1213#endif 1214 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
1214 __u64 mds_offset; /* Filelayout dense stripe */ 1215 __u64 mds_offset; /* Filelayout dense stripe */
1215 int pnfs_error;
1216 struct page *page_array[NFS_PAGEVEC_SIZE]; 1216 struct page *page_array[NFS_PAGEVEC_SIZE];
1217 struct nfs_client *ds_clp; /* pNFS data server */
1218};
1219
1220struct nfs_write_header {
1221 struct nfs_pgio_header header;
1222 struct nfs_write_data rpc_data;
1217}; 1223};
1218 1224
1219struct nfs_commit_data { 1225struct nfs_commit_data {