aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index d5fdae2eb183..4a2fee2cb62b 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -29,11 +29,6 @@
29#include <linux/security.h> 29#include <linux/security.h>
30#include <linux/syscalls.h> 30#include <linux/syscalls.h>
31/* 31/*
32 * This is needed for the following functions:
33 * - try_to_release_page
34 * - block_invalidatepage
35 * - generic_osync_inode
36 *
37 * FIXME: remove all knowledge of the buffer layer from the core VM 32 * FIXME: remove all knowledge of the buffer layer from the core VM
38 */ 33 */
39#include <linux/buffer_head.h> /* for generic_osync_inode */ 34#include <linux/buffer_head.h> /* for generic_osync_inode */
@@ -1009,7 +1004,7 @@ __generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
1009 if (pos < size) { 1004 if (pos < size) {
1010 retval = generic_file_direct_IO(READ, iocb, 1005 retval = generic_file_direct_IO(READ, iocb,
1011 iov, pos, nr_segs); 1006 iov, pos, nr_segs);
1012 if (retval >= 0 && !is_sync_kiocb(iocb)) 1007 if (retval > 0 && !is_sync_kiocb(iocb))
1013 retval = -EIOCBQUEUED; 1008 retval = -EIOCBQUEUED;
1014 if (retval > 0) 1009 if (retval > 0)
1015 *ppos = pos + retval; 1010 *ppos = pos + retval;
@@ -1973,6 +1968,7 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
1973 do { 1968 do {
1974 unsigned long index; 1969 unsigned long index;
1975 unsigned long offset; 1970 unsigned long offset;
1971 unsigned long maxlen;
1976 size_t copied; 1972 size_t copied;
1977 1973
1978 offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */ 1974 offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
@@ -1987,7 +1983,10 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
1987 * same page as we're writing to, without it being marked 1983 * same page as we're writing to, without it being marked
1988 * up-to-date. 1984 * up-to-date.
1989 */ 1985 */
1990 fault_in_pages_readable(buf, bytes); 1986 maxlen = cur_iov->iov_len - iov_base;
1987 if (maxlen > bytes)
1988 maxlen = bytes;
1989 fault_in_pages_readable(buf, maxlen);
1991 1990
1992 page = __grab_cache_page(mapping,index,&cached_page,&lru_pvec); 1991 page = __grab_cache_page(mapping,index,&cached_page,&lru_pvec);
1993 if (!page) { 1992 if (!page) {
@@ -2029,6 +2028,8 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
2029 filemap_set_next_iovec(&cur_iov, 2028 filemap_set_next_iovec(&cur_iov,
2030 &iov_base, status); 2029 &iov_base, status);
2031 buf = cur_iov->iov_base + iov_base; 2030 buf = cur_iov->iov_base + iov_base;
2031 } else {
2032 iov_base += status;
2032 } 2033 }
2033 } 2034 }
2034 } 2035 }