aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorFred Isaman <iisaman@netapp.com>2011-03-03 10:13:48 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-03-11 15:38:44 -0500
commitc76069bda0f17cd3e153e54d9ac01242909c6b15 (patch)
treeb21a8844fdcfbda430cda191c84597393398e461 /fs/nfs/write.c
parenta69aef1496726ed88386dad65abfcc8cd3195304 (diff)
NFSv4.1: rearrange ->doio args
This will make it possible to clear the lseg pointer in the same function as it is put, instead of in the caller nfs_pageio_doio(). Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index ee62ddf60e7a..b74200a2f753 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -898,20 +898,21 @@ static void nfs_redirty_request(struct nfs_page *req)
898 * Generate multiple small requests to write out a single 898 * Generate multiple small requests to write out a single
899 * contiguous dirty area on one page. 899 * contiguous dirty area on one page.
900 */ 900 */
901static int nfs_flush_multi(struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int how, struct pnfs_layout_segment *lseg) 901static int nfs_flush_multi(struct nfs_pageio_descriptor *desc)
902{ 902{
903 struct nfs_page *req = nfs_list_entry(head->next); 903 struct nfs_page *req = nfs_list_entry(desc->pg_list.next);
904 struct page *page = req->wb_page; 904 struct page *page = req->wb_page;
905 struct nfs_write_data *data; 905 struct nfs_write_data *data;
906 size_t wsize = NFS_SERVER(inode)->wsize, nbytes; 906 size_t wsize = NFS_SERVER(desc->pg_inode)->wsize, nbytes;
907 unsigned int offset; 907 unsigned int offset;
908 int requests = 0; 908 int requests = 0;
909 int ret = 0; 909 int ret = 0;
910 struct pnfs_layout_segment *lseg;
910 LIST_HEAD(list); 911 LIST_HEAD(list);
911 912
912 nfs_list_remove_request(req); 913 nfs_list_remove_request(req);
913 914
914 nbytes = count; 915 nbytes = desc->pg_count;
915 do { 916 do {
916 size_t len = min(nbytes, wsize); 917 size_t len = min(nbytes, wsize);
917 918
@@ -924,11 +925,11 @@ static int nfs_flush_multi(struct inode *inode, struct list_head *head, unsigned
924 } while (nbytes != 0); 925 } while (nbytes != 0);
925 atomic_set(&req->wb_complete, requests); 926 atomic_set(&req->wb_complete, requests);
926 927
927 BUG_ON(lseg); 928 BUG_ON(desc->pg_lseg);
928 lseg = pnfs_update_layout(inode, req->wb_context, IOMODE_RW); 929 lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_RW);
929 ClearPageError(page); 930 ClearPageError(page);
930 offset = 0; 931 offset = 0;
931 nbytes = count; 932 nbytes = desc->pg_count;
932 do { 933 do {
933 int ret2; 934 int ret2;
934 935
@@ -940,7 +941,7 @@ static int nfs_flush_multi(struct inode *inode, struct list_head *head, unsigned
940 if (nbytes < wsize) 941 if (nbytes < wsize)
941 wsize = nbytes; 942 wsize = nbytes;
942 ret2 = nfs_write_rpcsetup(req, data, &nfs_write_partial_ops, 943 ret2 = nfs_write_rpcsetup(req, data, &nfs_write_partial_ops,
943 wsize, offset, lseg, how); 944 wsize, offset, lseg, desc->pg_ioflags);
944 if (ret == 0) 945 if (ret == 0)
945 ret = ret2; 946 ret = ret2;
946 offset += wsize; 947 offset += wsize;
@@ -968,14 +969,17 @@ out_bad:
968 * This is the case if nfs_updatepage detects a conflicting request 969 * This is the case if nfs_updatepage detects a conflicting request
969 * that has been written but not committed. 970 * that has been written but not committed.
970 */ 971 */
971static int nfs_flush_one(struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int how, struct pnfs_layout_segment *lseg) 972static int nfs_flush_one(struct nfs_pageio_descriptor *desc)
972{ 973{
973 struct nfs_page *req; 974 struct nfs_page *req;
974 struct page **pages; 975 struct page **pages;
975 struct nfs_write_data *data; 976 struct nfs_write_data *data;
977 struct list_head *head = &desc->pg_list;
978 struct pnfs_layout_segment *lseg = desc->pg_lseg;
976 int ret; 979 int ret;
977 980
978 data = nfs_writedata_alloc(npages); 981 data = nfs_writedata_alloc(nfs_page_array_len(desc->pg_base,
982 desc->pg_count));
979 if (!data) { 983 if (!data) {
980 while (!list_empty(head)) { 984 while (!list_empty(head)) {
981 req = nfs_list_entry(head->next); 985 req = nfs_list_entry(head->next);
@@ -995,10 +999,10 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, unsigned i
995 } 999 }
996 req = nfs_list_entry(data->pages.next); 1000 req = nfs_list_entry(data->pages.next);
997 if ((!lseg) && list_is_singular(&data->pages)) 1001 if ((!lseg) && list_is_singular(&data->pages))
998 lseg = pnfs_update_layout(inode, req->wb_context, IOMODE_RW); 1002 lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_RW);
999 1003
1000 /* Set up the argument struct */ 1004 /* Set up the argument struct */
1001 ret = nfs_write_rpcsetup(req, data, &nfs_write_full_ops, count, 0, lseg, how); 1005 ret = nfs_write_rpcsetup(req, data, &nfs_write_full_ops, desc->pg_count, 0, lseg, desc->pg_ioflags);
1002out: 1006out:
1003 put_lseg(lseg); /* Cleans any gotten in ->pg_test */ 1007 put_lseg(lseg); /* Cleans any gotten in ->pg_test */
1004 return ret; 1008 return ret;