diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-01-09 02:38:23 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-01-09 02:38:23 -0500 |
commit | da733563be5a9da26fe81d9f007262d00b846e22 (patch) | |
tree | db28291df94a2043af2123911984c5c173da4e6f /mm/filemap.c | |
parent | 6ccbcf2cb41131f8d56ef0723bf3f7c1f8486076 (diff) | |
parent | dab78d7924598ea4031663dd10db814e2e324928 (diff) |
Merge branch 'next' into for-linus
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 645a080ba4df..c0018f2d50e0 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * most "normal" filesystems (but you don't /have/ to use this: | 9 | * most "normal" filesystems (but you don't /have/ to use this: |
10 | * the NFS filesystem used to do this differently, for example) | 10 | * the NFS filesystem used to do this differently, for example) |
11 | */ | 11 | */ |
12 | #include <linux/module.h> | 12 | #include <linux/export.h> |
13 | #include <linux/compiler.h> | 13 | #include <linux/compiler.h> |
14 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
15 | #include <linux/uaccess.h> | 15 | #include <linux/uaccess.h> |
@@ -827,13 +827,14 @@ unsigned find_get_pages(struct address_space *mapping, pgoff_t start, | |||
827 | { | 827 | { |
828 | unsigned int i; | 828 | unsigned int i; |
829 | unsigned int ret; | 829 | unsigned int ret; |
830 | unsigned int nr_found; | 830 | unsigned int nr_found, nr_skip; |
831 | 831 | ||
832 | rcu_read_lock(); | 832 | rcu_read_lock(); |
833 | restart: | 833 | restart: |
834 | nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree, | 834 | nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree, |
835 | (void ***)pages, NULL, start, nr_pages); | 835 | (void ***)pages, NULL, start, nr_pages); |
836 | ret = 0; | 836 | ret = 0; |
837 | nr_skip = 0; | ||
837 | for (i = 0; i < nr_found; i++) { | 838 | for (i = 0; i < nr_found; i++) { |
838 | struct page *page; | 839 | struct page *page; |
839 | repeat: | 840 | repeat: |
@@ -856,6 +857,7 @@ repeat: | |||
856 | * here as an exceptional entry: so skip over it - | 857 | * here as an exceptional entry: so skip over it - |
857 | * we only reach this from invalidate_mapping_pages(). | 858 | * we only reach this from invalidate_mapping_pages(). |
858 | */ | 859 | */ |
860 | nr_skip++; | ||
859 | continue; | 861 | continue; |
860 | } | 862 | } |
861 | 863 | ||
@@ -876,7 +878,7 @@ repeat: | |||
876 | * If all entries were removed before we could secure them, | 878 | * If all entries were removed before we could secure them, |
877 | * try again, because callers stop trying once 0 is returned. | 879 | * try again, because callers stop trying once 0 is returned. |
878 | */ | 880 | */ |
879 | if (unlikely(!ret && nr_found)) | 881 | if (unlikely(!ret && nr_found > nr_skip)) |
880 | goto restart; | 882 | goto restart; |
881 | rcu_read_unlock(); | 883 | rcu_read_unlock(); |
882 | return ret; | 884 | return ret; |
@@ -2113,6 +2115,7 @@ void iov_iter_advance(struct iov_iter *i, size_t bytes) | |||
2113 | } else { | 2115 | } else { |
2114 | const struct iovec *iov = i->iov; | 2116 | const struct iovec *iov = i->iov; |
2115 | size_t base = i->iov_offset; | 2117 | size_t base = i->iov_offset; |
2118 | unsigned long nr_segs = i->nr_segs; | ||
2116 | 2119 | ||
2117 | /* | 2120 | /* |
2118 | * The !iov->iov_len check ensures we skip over unlikely | 2121 | * The !iov->iov_len check ensures we skip over unlikely |
@@ -2128,11 +2131,13 @@ void iov_iter_advance(struct iov_iter *i, size_t bytes) | |||
2128 | base += copy; | 2131 | base += copy; |
2129 | if (iov->iov_len == base) { | 2132 | if (iov->iov_len == base) { |
2130 | iov++; | 2133 | iov++; |
2134 | nr_segs--; | ||
2131 | base = 0; | 2135 | base = 0; |
2132 | } | 2136 | } |
2133 | } | 2137 | } |
2134 | i->iov = iov; | 2138 | i->iov = iov; |
2135 | i->iov_offset = base; | 2139 | i->iov_offset = base; |
2140 | i->nr_segs = nr_segs; | ||
2136 | } | 2141 | } |
2137 | } | 2142 | } |
2138 | EXPORT_SYMBOL(iov_iter_advance); | 2143 | EXPORT_SYMBOL(iov_iter_advance); |