aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-12 13:42:02 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-15 09:12:20 -0400
commit50828d7e6767a92726708bc0666e2b8b84575808 (patch)
tree80f4a2fd19eb0cf232b6d5232eec28a45230c8e6 /fs
parent275acaafd45fbc8ecc3beabd6367e60b3049606a (diff)
NFS: Cache rpc_ops in struct nfs_pageio_descriptor
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/read.c19
-rw-r--r--fs/nfs/write.c20
2 files changed, 15 insertions, 24 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 0215bac35fc6..c14362fbe65f 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -327,6 +327,7 @@ static int nfs_pagein_multi(struct nfs_pageio_descriptor *desc, struct list_head
327 } while(nbytes != 0); 327 } while(nbytes != 0);
328 atomic_set(&req->wb_complete, requests); 328 atomic_set(&req->wb_complete, requests);
329 ClearPageError(page); 329 ClearPageError(page);
330 desc->pg_rpc_callops = &nfs_read_partial_ops;
330 return ret; 331 return ret;
331out_bad: 332out_bad:
332 while (!list_empty(res)) { 333 while (!list_empty(res)) {
@@ -367,6 +368,7 @@ static int nfs_pagein_one(struct nfs_pageio_descriptor *desc, struct list_head *
367 368
368 nfs_read_rpcsetup(req, data, desc->pg_count, 0); 369 nfs_read_rpcsetup(req, data, desc->pg_count, 0);
369 list_add(&data->list, res); 370 list_add(&data->list, res);
371 desc->pg_rpc_callops = &nfs_read_full_ops;
370out: 372out:
371 return ret; 373 return ret;
372} 374}
@@ -376,19 +378,14 @@ int nfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
376 LIST_HEAD(head); 378 LIST_HEAD(head);
377 int ret; 379 int ret;
378 380
379 if (desc->pg_bsize < PAGE_CACHE_SIZE) { 381 if (desc->pg_bsize < PAGE_CACHE_SIZE)
380 ret = nfs_pagein_multi(desc, &head); 382 ret = nfs_pagein_multi(desc, &head);
381 if (ret == 0) 383 else
382 ret = nfs_do_multiple_reads(&head,
383 &nfs_read_partial_ops,
384 desc->pg_lseg);
385 } else {
386 ret = nfs_pagein_one(desc, &head); 384 ret = nfs_pagein_one(desc, &head);
387 if (ret == 0) 385
388 ret = nfs_do_multiple_reads(&head, 386 if (ret == 0)
389 &nfs_read_full_ops, 387 ret = nfs_do_multiple_reads(&head, desc->pg_rpc_callops,
390 desc->pg_lseg); 388 desc->pg_lseg);
391 }
392 put_lseg(desc->pg_lseg); 389 put_lseg(desc->pg_lseg);
393 desc->pg_lseg = NULL; 390 desc->pg_lseg = NULL;
394 return ret; 391 return ret;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index bd4b34e5870b..71fbba72ace3 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -975,6 +975,7 @@ static int nfs_flush_multi(struct nfs_pageio_descriptor *desc, struct list_head
975 offset += len; 975 offset += len;
976 } while (nbytes != 0); 976 } while (nbytes != 0);
977 atomic_set(&req->wb_complete, requests); 977 atomic_set(&req->wb_complete, requests);
978 desc->pg_rpc_callops = &nfs_write_partial_ops;
978 return ret; 979 return ret;
979 980
980out_bad: 981out_bad:
@@ -1031,6 +1032,7 @@ static int nfs_flush_one(struct nfs_pageio_descriptor *desc, struct list_head *r
1031 /* Set up the argument struct */ 1032 /* Set up the argument struct */
1032 nfs_write_rpcsetup(req, data, desc->pg_count, 0, desc->pg_ioflags); 1033 nfs_write_rpcsetup(req, data, desc->pg_count, 0, desc->pg_ioflags);
1033 list_add(&data->list, res); 1034 list_add(&data->list, res);
1035 desc->pg_rpc_callops = &nfs_write_full_ops;
1034out: 1036out:
1035 return ret; 1037 return ret;
1036} 1038}
@@ -1040,21 +1042,13 @@ int nfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)
1040 LIST_HEAD(head); 1042 LIST_HEAD(head);
1041 int ret; 1043 int ret;
1042 1044
1043 if (desc->pg_bsize < PAGE_CACHE_SIZE) { 1045 if (desc->pg_bsize < PAGE_CACHE_SIZE)
1044 ret = nfs_flush_multi(desc, &head); 1046 ret = nfs_flush_multi(desc, &head);
1045 if (ret == 0) 1047 else
1046 ret = nfs_do_multiple_writes(&head,
1047 &nfs_write_partial_ops,
1048 desc->pg_lseg,
1049 desc->pg_ioflags);
1050 } else {
1051 ret = nfs_flush_one(desc, &head); 1048 ret = nfs_flush_one(desc, &head);
1052 if (ret == 0) 1049 if (ret == 0)
1053 ret = nfs_do_multiple_writes(&head, 1050 ret = nfs_do_multiple_writes(&head, desc->pg_rpc_callops,
1054 &nfs_write_full_ops, 1051 desc->pg_lseg, desc->pg_ioflags);
1055 desc->pg_lseg,
1056 desc->pg_ioflags);
1057 }
1058 put_lseg(desc->pg_lseg); 1052 put_lseg(desc->pg_lseg);
1059 desc->pg_lseg = NULL; 1053 desc->pg_lseg = NULL;
1060 return ret; 1054 return ret;