git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
netns: Fix arbitrary net_device-s corruptions on net_ns stop.
[safe/jmp/linux-2.6]
/
mm
/
filemap.c
diff --git
a/mm/filemap.c
b/mm/filemap.c
index
4eb958c
..
239d361
100644
(file)
--- a/
mm/filemap.c
+++ b/
mm/filemap.c
@@
-28,7
+28,6
@@
#include <linux/backing-dev.h>
#include <linux/pagevec.h>
#include <linux/blkdev.h>
#include <linux/backing-dev.h>
#include <linux/pagevec.h>
#include <linux/blkdev.h>
-#include <linux/backing-dev.h>
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/cpuset.h>
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/cpuset.h>
@@
-344,7
+343,7
@@
int sync_page_range(struct inode *inode, struct address_space *mapping,
EXPORT_SYMBOL(sync_page_range);
/**
EXPORT_SYMBOL(sync_page_range);
/**
- * sync_page_range_nolock
+ * sync_page_range_nolock
- write & wait on all pages in the passed range without locking
* @inode: target inode
* @mapping: target address_space
* @pos: beginning offset in pages to write
* @inode: target inode
* @mapping: target address_space
* @pos: beginning offset in pages to write
@@
-577,10
+576,12
@@
EXPORT_SYMBOL(unlock_page);
*/
void end_page_writeback(struct page *page)
{
*/
void end_page_writeback(struct page *page)
{
- if (!TestClearPageReclaim(page) || rotate_reclaimable_page(page)) {
- if (!test_clear_page_writeback(page))
- BUG();
- }
+ if (TestClearPageReclaim(page))
+ rotate_reclaimable_page(page);
+
+ if (!test_clear_page_writeback(page))
+ BUG();
+
smp_mb__after_clear_bit();
wake_up_page(page, PG_writeback);
}
smp_mb__after_clear_bit();
wake_up_page(page, PG_writeback);
}
@@
-604,7
+605,7
@@
void __lock_page(struct page *page)
}
EXPORT_SYMBOL(__lock_page);
}
EXPORT_SYMBOL(__lock_page);
-int
fastcall
__lock_page_killable(struct page *page)
+int __lock_page_killable(struct page *page)
{
DEFINE_WAIT_BIT(wait, &page->flags, PG_locked);
{
DEFINE_WAIT_BIT(wait, &page->flags, PG_locked);
@@
-612,7
+613,10
@@
int fastcall __lock_page_killable(struct page *page)
sync_page_killable, TASK_KILLABLE);
}
sync_page_killable, TASK_KILLABLE);
}
-/*
+/**
+ * __lock_page_nosync - get a lock on the page, without calling sync_page()
+ * @page: the page to lock
+ *
* Variant of lock_page that does not require the caller to hold a reference
* on the page's mapping.
*/
* Variant of lock_page that does not require the caller to hold a reference
* on the page's mapping.
*/
@@
-875,9
+879,7
@@
static void shrink_readahead_size_eio(struct file *filp,
}
/**
}
/**
- * do_generic_mapping_read - generic file read routine
- * @mapping: address_space to be read
- * @ra: file's readahead state
+ * do_generic_file_read - generic file read routine
* @filp: the file to read
* @ppos: current file position
* @desc: read_descriptor
* @filp: the file to read
* @ppos: current file position
* @desc: read_descriptor
@@
-888,18
+890,13
@@
static void shrink_readahead_size_eio(struct file *filp,
*
* This is really ugly. But the goto's actually try to clarify some
* of the logic when it comes to error handling etc.
*
* This is really ugly. But the goto's actually try to clarify some
* of the logic when it comes to error handling etc.
- *
- * Note the struct file* is only passed for the use of readpage.
- * It may be NULL.
*/
*/
-void do_generic_mapping_read(struct address_space *mapping,
- struct file_ra_state *ra,
- struct file *filp,
- loff_t *ppos,
- read_descriptor_t *desc,
- read_actor_t actor)
+static void do_generic_file_read(struct file *filp, loff_t *ppos,
+ read_descriptor_t *desc, read_actor_t actor)
{
{
+ struct address_space *mapping = filp->f_mapping;
struct inode *inode = mapping->host;
struct inode *inode = mapping->host;
+ struct file_ra_state *ra = &filp->f_ra;
pgoff_t index;
pgoff_t last_index;
pgoff_t prev_index;
pgoff_t index;
pgoff_t last_index;
pgoff_t prev_index;
@@
-1091,7
+1088,6
@@
out:
if (filp)
file_accessed(filp);
}
if (filp)
file_accessed(filp);
}
-EXPORT_SYMBOL(do_generic_mapping_read);
int file_read_actor(read_descriptor_t *desc, struct page *page,
unsigned long offset, unsigned long size)
int file_read_actor(read_descriptor_t *desc, struct page *page,
unsigned long offset, unsigned long size)
@@
-1547,9
+1543,20
@@
repeat:
return page;
}
return page;
}
-/*
+/**
+ * read_cache_page_async - read into page cache, fill it if needed
+ * @mapping: the page's address_space
+ * @index: the page index
+ * @filler: function to perform the read
+ * @data: destination for read data
+ *
* Same as read_cache_page, but don't wait for page to become unlocked
* after submitting it to the filler.
* Same as read_cache_page, but don't wait for page to become unlocked
* after submitting it to the filler.
+ *
+ * Read into the page cache. If a page already exists, and PageUptodate() is
+ * not set, try to fill the page but don't wait for it to become unlocked.
+ *
+ * If the page does not get brought uptodate, return -EIO.
*/
struct page *read_cache_page_async(struct address_space *mapping,
pgoff_t index,
*/
struct page *read_cache_page_async(struct address_space *mapping,
pgoff_t index,
@@
-1751,21
+1758,27
@@
size_t iov_iter_copy_from_user(struct page *page,
}
EXPORT_SYMBOL(iov_iter_copy_from_user);
}
EXPORT_SYMBOL(iov_iter_copy_from_user);
-
static void __iov_iter_advance_iov
(struct iov_iter *i, size_t bytes)
+
void iov_iter_advance
(struct iov_iter *i, size_t bytes)
{
{
+ BUG_ON(i->count < bytes);
+
if (likely(i->nr_segs == 1)) {
i->iov_offset += bytes;
if (likely(i->nr_segs == 1)) {
i->iov_offset += bytes;
+ i->count -= bytes;
} else {
const struct iovec *iov = i->iov;
size_t base = i->iov_offset;
/*
* The !iov->iov_len check ensures we skip over unlikely
} else {
const struct iovec *iov = i->iov;
size_t base = i->iov_offset;
/*
* The !iov->iov_len check ensures we skip over unlikely
- * zero-length segments.
+ * zero-length segments
(without overruning the iovec)
.
*/
*/
- while (bytes ||
!iov->iov_len
) {
- int copy
= min(bytes, iov->iov_len - base)
;
+ while (bytes ||
unlikely(!iov->iov_len && i->count)
) {
+ int copy;
+ copy = min(bytes, iov->iov_len - base);
+ BUG_ON(!i->count || i->count < copy);
+ i->count -= copy;
bytes -= copy;
base += copy;
if (iov->iov_len == base) {
bytes -= copy;
base += copy;
if (iov->iov_len == base) {
@@
-1777,14
+1790,6
@@
static void __iov_iter_advance_iov(struct iov_iter *i, size_t bytes)
i->iov_offset = base;
}
}
i->iov_offset = base;
}
}
-
-void iov_iter_advance(struct iov_iter *i, size_t bytes)
-{
- BUG_ON(i->count < bytes);
-
- __iov_iter_advance_iov(i, bytes);
- i->count -= bytes;
-}
EXPORT_SYMBOL(iov_iter_advance);
/*
EXPORT_SYMBOL(iov_iter_advance);
/*