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>
This commit is contained in:
parent
92cf765237
commit
b6aa5901c7
3 changed files with 15 additions and 10 deletions
|
@ -384,7 +384,7 @@ static ssize_t ceph_sync_read(struct file *file, char __user *data,
|
|||
|
||||
if (file->f_flags & O_DIRECT) {
|
||||
num_pages = calc_pages_for((unsigned long)data, len);
|
||||
pages = ceph_get_direct_page_vector(data, num_pages);
|
||||
pages = ceph_get_direct_page_vector(data, num_pages, true);
|
||||
} else {
|
||||
num_pages = calc_pages_for(off, len);
|
||||
pages = ceph_alloc_page_vector(num_pages, GFP_NOFS);
|
||||
|
@ -413,7 +413,7 @@ static ssize_t ceph_sync_read(struct file *file, char __user *data,
|
|||
|
||||
done:
|
||||
if (file->f_flags & O_DIRECT)
|
||||
ceph_put_page_vector(pages, num_pages);
|
||||
ceph_put_page_vector(pages, num_pages, true);
|
||||
else
|
||||
ceph_release_page_vector(pages, num_pages);
|
||||
dout("sync_read result %d\n", ret);
|
||||
|
@ -522,7 +522,7 @@ more:
|
|||
return -ENOMEM;
|
||||
|
||||
if (file->f_flags & O_DIRECT) {
|
||||
pages = ceph_get_direct_page_vector(data, num_pages);
|
||||
pages = ceph_get_direct_page_vector(data, num_pages, false);
|
||||
if (IS_ERR(pages)) {
|
||||
ret = PTR_ERR(pages);
|
||||
goto out;
|
||||
|
@ -572,7 +572,7 @@ more:
|
|||
}
|
||||
|
||||
if (file->f_flags & O_DIRECT)
|
||||
ceph_put_page_vector(pages, num_pages);
|
||||
ceph_put_page_vector(pages, num_pages, false);
|
||||
else if (file->f_flags & O_SYNC)
|
||||
ceph_release_page_vector(pages, num_pages);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue