aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r--fs/nfs/read.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 65c0c5b32351..da9cf11c326f 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -116,10 +116,17 @@ static void nfs_readpage_truncate_uninitialised_page(struct nfs_read_data *data)
116 pages = &data->args.pages[base >> PAGE_CACHE_SHIFT]; 116 pages = &data->args.pages[base >> PAGE_CACHE_SHIFT];
117 base &= ~PAGE_CACHE_MASK; 117 base &= ~PAGE_CACHE_MASK;
118 pglen = PAGE_CACHE_SIZE - base; 118 pglen = PAGE_CACHE_SIZE - base;
119 if (pglen < remainder) 119 for (;;) {
120 if (remainder <= pglen) {
121 memclear_highpage_flush(*pages, base, remainder);
122 break;
123 }
120 memclear_highpage_flush(*pages, base, pglen); 124 memclear_highpage_flush(*pages, base, pglen);
121 else 125 pages++;
122 memclear_highpage_flush(*pages, base, remainder); 126 remainder -= pglen;
127 pglen = PAGE_CACHE_SIZE;
128 base = 0;
129 }
123} 130}
124 131
125/* 132/*
@@ -476,6 +483,8 @@ static void nfs_readpage_set_pages_uptodate(struct nfs_read_data *data)
476 unsigned int base = data->args.pgbase; 483 unsigned int base = data->args.pgbase;
477 struct page **pages; 484 struct page **pages;
478 485
486 if (data->res.eof)
487 count = data->args.count;
479 if (unlikely(count == 0)) 488 if (unlikely(count == 0))
480 return; 489 return;
481 pages = &data->args.pages[base >> PAGE_CACHE_SHIFT]; 490 pages = &data->args.pages[base >> PAGE_CACHE_SHIFT];
@@ -483,11 +492,7 @@ static void nfs_readpage_set_pages_uptodate(struct nfs_read_data *data)
483 count += base; 492 count += base;
484 for (;count >= PAGE_CACHE_SIZE; count -= PAGE_CACHE_SIZE, pages++) 493 for (;count >= PAGE_CACHE_SIZE; count -= PAGE_CACHE_SIZE, pages++)
485 SetPageUptodate(*pages); 494 SetPageUptodate(*pages);
486 /* 495 if (count != 0)
487 * Was this an eof or a short read? If the latter, don't mark the page
488 * as uptodate yet.
489 */
490 if (count > 0 && (data->res.eof || data->args.count == data->res.count))
491 SetPageUptodate(*pages); 496 SetPageUptodate(*pages);
492} 497}
493 498
@@ -502,6 +507,8 @@ static void nfs_readpage_set_pages_error(struct nfs_read_data *data)
502 count += base; 507 count += base;
503 for (;count >= PAGE_CACHE_SIZE; count -= PAGE_CACHE_SIZE, pages++) 508 for (;count >= PAGE_CACHE_SIZE; count -= PAGE_CACHE_SIZE, pages++)
504 SetPageError(*pages); 509 SetPageError(*pages);
510 if (count != 0)
511 SetPageError(*pages);
505} 512}
506 513
507/* 514/*