aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-04-03 22:31:22 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-05-06 17:39:42 -0400
commit2b777c9dd9ebbb2f8b6818d454cc5e6d7c1e3c8b (patch)
treeaceac852de465a0205a7073496126925620ea7cf /net/ceph
parentf0d1bec9d58d4c038d0ac958c9af82be6eb18045 (diff)
ceph_sync_read: stop poking into iov_iter guts
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/pagevec.c35
1 files changed, 4 insertions, 31 deletions
diff --git a/net/ceph/pagevec.c b/net/ceph/pagevec.c
index 815a2249cfa9..555013034f7a 100644
--- a/net/ceph/pagevec.c
+++ b/net/ceph/pagevec.c
@@ -53,7 +53,10 @@ void ceph_put_page_vector(struct page **pages, int num_pages, bool dirty)
53 set_page_dirty_lock(pages[i]); 53 set_page_dirty_lock(pages[i]);
54 put_page(pages[i]); 54 put_page(pages[i]);
55 } 55 }
56 kfree(pages); 56 if (is_vmalloc_addr(pages))
57 vfree(pages);
58 else
59 kfree(pages);
57} 60}
58EXPORT_SYMBOL(ceph_put_page_vector); 61EXPORT_SYMBOL(ceph_put_page_vector);
59 62
@@ -165,36 +168,6 @@ void ceph_copy_from_page_vector(struct page **pages,
165EXPORT_SYMBOL(ceph_copy_from_page_vector); 168EXPORT_SYMBOL(ceph_copy_from_page_vector);
166 169
167/* 170/*
168 * copy user data from a page vector into a user pointer
169 */
170int ceph_copy_page_vector_to_user(struct page **pages,
171 void __user *data,
172 loff_t off, size_t len)
173{
174 int i = 0;
175 int po = off & ~PAGE_CACHE_MASK;
176 int left = len;
177 int l, bad;
178
179 while (left > 0) {
180 l = min_t(int, left, PAGE_CACHE_SIZE-po);
181 bad = copy_to_user(data, page_address(pages[i]) + po, l);
182 if (bad == l)
183 return -EFAULT;
184 data += l - bad;
185 left -= l - bad;
186 if (po) {
187 po += l - bad;
188 if (po == PAGE_CACHE_SIZE)
189 po = 0;
190 }
191 i++;
192 }
193 return len;
194}
195EXPORT_SYMBOL(ceph_copy_page_vector_to_user);
196
197/*
198 * Zero an extent within a page vector. Offset is relative to the 171 * Zero an extent within a page vector. Offset is relative to the
199 * start of the first page. 172 * start of the first page.
200 */ 173 */