diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-05 05:35:38 (GMT) |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-06 15:46:36 (GMT) |
commit | 49a70f278658894d2899824cd4037095fb6711fe (patch) | |
tree | 8fc0e55be04a421ee9091a989c30807d891d7930 /fs/nfs/read.c | |
parent | 277459d2e2cd40594967757e8fd016c4c7016614 (diff) | |
download | linux-fsl-qoriq-49a70f278658894d2899824cd4037095fb6711fe.tar.xz |
NFS: Cleanup: add common helper nfs_page_length()
Clean up a lot of ad-hoc page length calculations in fs/nfs/write.c
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r-- | fs/nfs/read.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index cca9fa2..05cca66 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -30,6 +30,7 @@ #include <asm/system.h> +#include "internal.h" #include "iostat.h" #define NFSDBG_FACILITY NFSDBG_PAGECACHE @@ -84,22 +85,6 @@ void nfs_readdata_release(void *data) } static -unsigned int nfs_page_length(struct inode *inode, struct page *page) -{ - loff_t i_size = i_size_read(inode); - unsigned long idx; - - if (i_size <= 0) - return 0; - idx = (i_size - 1) >> PAGE_CACHE_SHIFT; - if (page->index > idx) - return 0; - if (page->index != idx) - return PAGE_CACHE_SIZE; - return 1 + ((i_size - 1) & (PAGE_CACHE_SIZE - 1)); -} - -static int nfs_return_empty_page(struct page *page) { 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, struct nfs_page *new; unsigned int len; - len = nfs_page_length(inode, page); + len = nfs_page_length(page); if (len == 0) return nfs_return_empty_page(page); new = nfs_create_request(ctx, inode, page, 0, len); @@ -667,7 +652,7 @@ readpage_async_filler(void *data, struct page *page) unsigned int len; nfs_wb_page(inode, page); - len = nfs_page_length(inode, page); + len = nfs_page_length(page); if (len == 0) return nfs_return_empty_page(page); new = nfs_create_request(desc->ctx, inode, page, 0, len); |