diff options
| author | Patrick McHardy <kaber@trash.net> | 2011-01-14 14:12:37 +0100 |
|---|---|---|
| committer | Patrick McHardy <kaber@trash.net> | 2011-01-14 14:12:37 +0100 |
| commit | 0134e89c7bcc9fde1da962c82a120691e185619f (patch) | |
| tree | 3e03335cf001019a2687d161e956de4f73379984 /net/ceph/pagevec.c | |
| parent | c7066f70d9610df0b9406cc635fc09e86136e714 (diff) | |
| parent | 6faee60a4e82075853a437831768cc9e2e563e4e (diff) | |
Merge branch 'master' of git://1984.lsi.us.es/net-next-2.6
Conflicts:
net/ipv4/route.c
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ceph/pagevec.c')
| -rw-r--r-- | net/ceph/pagevec.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/ceph/pagevec.c b/net/ceph/pagevec.c index 54caf068715..1a040e64c69 100644 --- a/net/ceph/pagevec.c +++ b/net/ceph/pagevec.c @@ -13,8 +13,7 @@ * build a vector of user pages */ struct page **ceph_get_direct_page_vector(const char __user *data, - int num_pages, - loff_t off, size_t len) + int num_pages, bool write_page) { struct page **pages; int rc; @@ -25,24 +24,27 @@ struct page **ceph_get_direct_page_vector(const char __user *data, down_read(¤t->mm->mmap_sem); rc = get_user_pages(current, current->mm, (unsigned long)data, - num_pages, 0, 0, pages, NULL); + num_pages, write_page, 0, pages, NULL); up_read(¤t->mm->mmap_sem); - if (rc < 0) + if (rc < num_pages) goto fail; return pages; fail: - kfree(pages); + ceph_put_page_vector(pages, rc > 0 ? rc : 0, false); return ERR_PTR(rc); } EXPORT_SYMBOL(ceph_get_direct_page_vector); -void ceph_put_page_vector(struct page **pages, int num_pages) +void ceph_put_page_vector(struct page **pages, int num_pages, bool dirty) { int i; - for (i = 0; i < num_pages; i++) + for (i = 0; i < num_pages; i++) { + if (dirty) + set_page_dirty_lock(pages[i]); put_page(pages[i]); + } kfree(pages); } EXPORT_SYMBOL(ceph_put_page_vector); |
