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.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index cca9fa259994..05cca6609977 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -30,6 +30,7 @@
30 30
31#include <asm/system.h> 31#include <asm/system.h>
32 32
33#include "internal.h"
33#include "iostat.h" 34#include "iostat.h"
34 35
35#define NFSDBG_FACILITY NFSDBG_PAGECACHE 36#define NFSDBG_FACILITY NFSDBG_PAGECACHE
@@ -84,22 +85,6 @@ void nfs_readdata_release(void *data)
84} 85}
85 86
86static 87static
87unsigned int nfs_page_length(struct inode *inode, struct page *page)
88{
89 loff_t i_size = i_size_read(inode);
90 unsigned long idx;
91
92 if (i_size <= 0)
93 return 0;
94 idx = (i_size - 1) >> PAGE_CACHE_SHIFT;
95 if (page->index > idx)
96 return 0;
97 if (page->index != idx)
98 return PAGE_CACHE_SIZE;
99 return 1 + ((i_size - 1) & (PAGE_CACHE_SIZE - 1));
100}
101
102static
103int nfs_return_empty_page(struct page *page) 88int nfs_return_empty_page(struct page *page)
104{ 89{
105 memclear_highpage_flush(page, 0, PAGE_CACHE_SIZE); 90 memclear_highpage_flush(page, 0, PAGE_CACHE_SIZE);
@@ -231,7 +216,7 @@ static int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode,
231 struct nfs_page *new; 216 struct nfs_page *new;
232 unsigned int len; 217 unsigned int len;
233 218
234 len = nfs_page_length(inode, page); 219 len = nfs_page_length(page);
235 if (len == 0) 220 if (len == 0)
236 return nfs_return_empty_page(page); 221 return nfs_return_empty_page(page);
237 new = nfs_create_request(ctx, inode, page, 0, len); 222 new = nfs_create_request(ctx, inode, page, 0, len);
@@ -667,7 +652,7 @@ readpage_async_filler(void *data, struct page *page)
667 unsigned int len; 652 unsigned int len;
668 653
669 nfs_wb_page(inode, page); 654 nfs_wb_page(inode, page);
670 len = nfs_page_length(inode, page); 655 len = nfs_page_length(page);
671 if (len == 0) 656 if (len == 0)
672 return nfs_return_empty_page(page); 657 return nfs_return_empty_page(page);
673 new = nfs_create_request(desc->ctx, inode, page, 0, len); 658 new = nfs_create_request(desc->ctx, inode, page, 0, len);