aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/read.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-04-02 18:48:28 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-05-01 01:17:04 -0400
commitd8a5ad75cc4d577987964e37a4c43b1c648c201e (patch)
tree91604bf17f7a81cc60a214426c7ddca89bf4faee /fs/nfs/read.c
parent91e59c368c6ba5eed0369a085c42c9f270b97aa8 (diff)
NFS: Cleanup the coalescing code
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r--fs/nfs/read.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 6ab4d5a9edf2..97f0f42e136d 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -328,24 +328,26 @@ out_bad:
328} 328}
329 329
330static int 330static int
331nfs_pagein_list(struct list_head *head, int rpages) 331nfs_pagein_list(struct list_head *head, unsigned int rsize)
332{ 332{
333 LIST_HEAD(one_request); 333 struct nfs_pageio_descriptor desc;
334 struct nfs_page *req; 334 struct nfs_page *req;
335 int error = 0; 335 unsigned int pages = 0;
336 unsigned int pages = 0; 336 int error = 0;
337 337
338 while (!list_empty(head)) { 338 while (!list_empty(head)) {
339 pages += nfs_coalesce_requests(head, &one_request, rpages); 339 nfs_pageio_init(&desc, rsize);
340 req = nfs_list_entry(one_request.next); 340 nfs_pageio_add_list(&desc, head);
341 error = nfs_pagein_one(&one_request, req->wb_context->dentry->d_inode); 341 req = nfs_list_entry(desc.pg_list.next);
342 error = nfs_pagein_one(&desc.pg_list, req->wb_context->dentry->d_inode);
342 if (error < 0) 343 if (error < 0)
343 break; 344 break;
345 pages += (desc.pg_count + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
344 } 346 }
345 if (error >= 0)
346 return pages;
347 347
348 nfs_async_read_error(head); 348 nfs_async_read_error(head);
349 if (error >= 0)
350 return pages;
349 return error; 351 return error;
350} 352}
351 353
@@ -595,7 +597,7 @@ int nfs_readpages(struct file *filp, struct address_space *mapping,
595 filp->private_data); 597 filp->private_data);
596 ret = read_cache_pages(mapping, pages, readpage_async_filler, &desc); 598 ret = read_cache_pages(mapping, pages, readpage_async_filler, &desc);
597 if (!list_empty(&head)) { 599 if (!list_empty(&head)) {
598 int err = nfs_pagein_list(&head, server->rpages); 600 int err = nfs_pagein_list(&head, server->rsize);
599 if (!ret) 601 if (!ret)
600 nfs_add_stats(inode, NFSIOS_READPAGES, err); 602 nfs_add_stats(inode, NFSIOS_READPAGES, err);
601 ret = err; 603 ret = err;