aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorHenry C Chang <henry_c_chang@tcloudcomputing.com>2010-12-15 23:45:41 -0500
committerSage Weil <sage@newdream.net>2010-12-17 12:54:40 -0500
commitb6aa5901c7a2bd90d0b6b9866300d2648b2568f3 (patch)
tree1161ed9dbacb7ace73c5d48fc9acd1db0d7815d5 /net/ceph
parent92cf765237e2787eb168096305c448caf25ac7f8 (diff)
ceph: mark user pages dirty on direct-io reads
For read operation, we have to set the argument _write_ of get_user_pages to 1 since we will write data to pages. Also, we need to SetPageDirty before releasing these pages. Signed-off-by: Henry C Chang <henry_c_chang@tcloudcomputing.com> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/pagevec.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ceph/pagevec.c b/net/ceph/pagevec.c
index ac34feeb2b3a..01947a5d03b7 100644
--- a/net/ceph/pagevec.c
+++ b/net/ceph/pagevec.c
@@ -13,7 +13,7 @@
13 * build a vector of user pages 13 * build a vector of user pages
14 */ 14 */
15struct page **ceph_get_direct_page_vector(const char __user *data, 15struct page **ceph_get_direct_page_vector(const char __user *data,
16 int num_pages) 16 int num_pages, bool write_page)
17{ 17{
18 struct page **pages; 18 struct page **pages;
19 int rc; 19 int rc;
@@ -24,7 +24,7 @@ struct page **ceph_get_direct_page_vector(const char __user *data,
24 24
25 down_read(&current->mm->mmap_sem); 25 down_read(&current->mm->mmap_sem);
26 rc = get_user_pages(current, current->mm, (unsigned long)data, 26 rc = get_user_pages(current, current->mm, (unsigned long)data,
27 num_pages, 0, 0, pages, NULL); 27 num_pages, write_page, 0, pages, NULL);
28 up_read(&current->mm->mmap_sem); 28 up_read(&current->mm->mmap_sem);
29 if (rc < 0) 29 if (rc < 0)
30 goto fail; 30 goto fail;
@@ -36,12 +36,15 @@ fail:
36} 36}
37EXPORT_SYMBOL(ceph_get_direct_page_vector); 37EXPORT_SYMBOL(ceph_get_direct_page_vector);
38 38
39void ceph_put_page_vector(struct page **pages, int num_pages) 39void ceph_put_page_vector(struct page **pages, int num_pages, bool dirty)
40{ 40{
41 int i; 41 int i;
42 42
43 for (i = 0; i < num_pages; i++) 43 for (i = 0; i < num_pages; i++) {
44 if (dirty)
45 set_page_dirty_lock(pages[i]);
44 put_page(pages[i]); 46 put_page(pages[i]);
47 }
45 kfree(pages); 48 kfree(pages);
46} 49}
47EXPORT_SYMBOL(ceph_put_page_vector); 50EXPORT_SYMBOL(ceph_put_page_vector);