Commit 2ec3a12a authored by Al Viro's avatar Al Viro

cachefiles_write_page(): switch to __kernel_write()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 59482291
...@@ -880,7 +880,6 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page) ...@@ -880,7 +880,6 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
{ {
struct cachefiles_object *object; struct cachefiles_object *object;
struct cachefiles_cache *cache; struct cachefiles_cache *cache;
mm_segment_t old_fs;
struct file *file; struct file *file;
struct path path; struct path path;
loff_t pos, eof; loff_t pos, eof;
...@@ -914,8 +913,6 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page) ...@@ -914,8 +913,6 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
if (IS_ERR(file)) { if (IS_ERR(file)) {
ret = PTR_ERR(file); ret = PTR_ERR(file);
} else { } else {
ret = -EIO;
if (file->f_op->write) {
pos = (loff_t) page->index << PAGE_SHIFT; pos = (loff_t) page->index << PAGE_SHIFT;
/* we mustn't write more data than we have, so we have /* we mustn't write more data than we have, so we have
...@@ -933,17 +930,10 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page) ...@@ -933,17 +930,10 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
} }
data = kmap(page); data = kmap(page);
file_start_write(file); ret = __kernel_write(file, data, len, &pos);
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = file->f_op->write(
file, (const void __user *) data, len, &pos);
set_fs(old_fs);
kunmap(page); kunmap(page);
file_end_write(file);
if (ret != len) if (ret != len)
ret = -EIO; ret = -EIO;
}
fput(file); fput(file);
} }
......
...@@ -513,6 +513,8 @@ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t ...@@ -513,6 +513,8 @@ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t
return ret; return ret;
} }
EXPORT_SYMBOL(__kernel_write);
ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos) ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos)
{ {
ssize_t ret; ssize_t ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment