summaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-16 01:07:24 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-16 01:07:24 +0000
commit95db6b748fc86297827fbd9c9ef174d491c9ad89 (patch)
tree27a92a942821cde1edda9a1b088718d436b3efe4 /mm/filemap.c
parent45b27b0a0652331d104c953a5b192d843fff88f8 (diff)
Merge with Linux 2.3.40.
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 35a4b6d37..63a50b7e6 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -547,24 +547,22 @@ static inline int page_cache_read(struct file * file, unsigned long offset)
/*
* Read in an entire cluster at once. A cluster is usually a 64k-
- * aligned block that includes the address requested in "offset."
+ * aligned block that includes the page requested in "offset."
*/
-static int read_cluster_nonblocking(struct file * file, unsigned long offset)
+static int read_cluster_nonblocking(struct file * file, unsigned long offset,
+ unsigned long filesize)
{
- int error = 0;
- unsigned long filesize = (file->f_dentry->d_inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
unsigned long pages = CLUSTER_PAGES;
offset = CLUSTER_OFFSET(offset);
while ((pages-- > 0) && (offset < filesize)) {
- error = page_cache_read(file, offset);
- if (error >= 0)
- offset ++;
- else
- break;
+ int error = page_cache_read(file, offset);
+ if (error < 0)
+ return error;
+ offset ++;
}
- return error;
+ return 0;
}
/*
@@ -1364,7 +1362,7 @@ no_cached_page:
* so we need to map a zero page.
*/
if (pgoff < size)
- error = read_cluster_nonblocking(file, pgoff);
+ error = read_cluster_nonblocking(file, pgoff, size);
else
error = page_cache_read(file, pgoff);