diff options
| author | Fred Isaman <iisaman@netapp.com> | 2012-04-20 14:47:44 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-04-27 14:10:37 -0400 |
| commit | cd841605f7a721878d8a2d1362484723d8abf569 (patch) | |
| tree | b5c37db575cd545a183577249909e042fe38d646 /include/linux | |
| parent | b5542849764aa56fd3f05c0041195b637b9d2ac2 (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')
| -rw-r--r-- | include/linux/nfs_fs.h | 12 | ||||
| -rw-r--r-- | include/linux/nfs_xdr.h | 48 |
2 files changed, 27 insertions, 33 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index d5d68f322bf0..8d3a2b804201 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
| @@ -569,12 +569,6 @@ nfs_have_writebacks(struct inode *inode) | |||
| 569 | } | 569 | } |
| 570 | 570 | ||
| 571 | /* | 571 | /* |
| 572 | * Allocate nfs_write_data structures | ||
| 573 | */ | ||
| 574 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int npages); | ||
| 575 | extern void nfs_writedata_free(struct nfs_write_data *); | ||
| 576 | |||
| 577 | /* | ||
| 578 | * linux/fs/nfs/read.c | 572 | * linux/fs/nfs/read.c |
| 579 | */ | 573 | */ |
| 580 | extern int nfs_readpage(struct file *, struct page *); | 574 | extern int nfs_readpage(struct file *, struct page *); |
| @@ -585,12 +579,6 @@ extern int nfs_readpage_async(struct nfs_open_context *, struct inode *, | |||
| 585 | struct page *); | 579 | struct page *); |
| 586 | 580 | ||
| 587 | /* | 581 | /* |
| 588 | * Allocate nfs_read_data structures | ||
| 589 | */ | ||
| 590 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int npages); | ||
| 591 | extern void nfs_readdata_free(struct nfs_read_data *); | ||
| 592 | |||
| 593 | /* | ||
| 594 | * linux/fs/nfs3proc.c | 582 | * linux/fs/nfs3proc.c |
| 595 | */ | 583 | */ |
| 596 | #ifdef CONFIG_NFS_V3_ACL | 584 | #ifdef CONFIG_NFS_V3_ACL |
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 | ||
| 1170 | struct nfs_read_data { | 1170 | struct 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 | |||
| 1186 | struct 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 | |||
| 1196 | struct nfs_read_header { | ||
| 1197 | struct nfs_pgio_header header; | ||
| 1198 | struct nfs_read_data rpc_data; | ||
| 1190 | }; | 1199 | }; |
| 1191 | 1200 | ||
| 1192 | struct nfs_direct_req; | 1201 | struct nfs_direct_req; |
| 1193 | 1202 | ||
| 1194 | struct nfs_write_data { | 1203 | struct 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 | |||
| 1220 | struct nfs_write_header { | ||
| 1221 | struct nfs_pgio_header header; | ||
| 1222 | struct nfs_write_data rpc_data; | ||
| 1217 | }; | 1223 | }; |
| 1218 | 1224 | ||
| 1219 | struct nfs_commit_data { | 1225 | struct nfs_commit_data { |
