aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-04-03 14:33:23 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-05-06 17:39:41 -0400
commit84c3d55cc474f9c234c023c92e2769f940d5548c (patch)
treeaa65ab36c01db689a2c8427cc83f67d14a2f0a9b /fs/fuse
parentb30ac0fc4109701fc122d41ee085c65b52dc44a3 (diff)
fuse: switch to ->write_iter()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/file.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a25fa9059faa..7fbc803cf51d 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1182,18 +1182,17 @@ static ssize_t fuse_perform_write(struct file *file,
1182 return res > 0 ? res : err; 1182 return res > 0 ? res : err;
1183} 1183}
1184 1184
1185static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, 1185static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
1186 unsigned long nr_segs, loff_t pos)
1187{ 1186{
1188 struct file *file = iocb->ki_filp; 1187 struct file *file = iocb->ki_filp;
1189 struct address_space *mapping = file->f_mapping; 1188 struct address_space *mapping = file->f_mapping;
1190 size_t count; 1189 size_t count = iov_iter_count(from);
1191 ssize_t written = 0; 1190 ssize_t written = 0;
1192 ssize_t written_buffered = 0; 1191 ssize_t written_buffered = 0;
1193 struct inode *inode = mapping->host; 1192 struct inode *inode = mapping->host;
1194 ssize_t err; 1193 ssize_t err;
1195 struct iov_iter i;
1196 loff_t endbyte = 0; 1194 loff_t endbyte = 0;
1195 loff_t pos = iocb->ki_pos;
1197 1196
1198 if (get_fuse_conn(inode)->writeback_cache) { 1197 if (get_fuse_conn(inode)->writeback_cache) {
1199 /* Update size (EOF optimization) and mode (SUID clearing) */ 1198 /* Update size (EOF optimization) and mode (SUID clearing) */
@@ -1201,13 +1200,9 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
1201 if (err) 1200 if (err)
1202 return err; 1201 return err;
1203 1202
1204 return generic_file_aio_write(iocb, iov, nr_segs, pos); 1203 return generic_file_write_iter(iocb, from);
1205 } 1204 }
1206 1205
1207 WARN_ON(iocb->ki_pos != pos);
1208
1209 count = iov_length(iov, nr_segs);
1210 iov_iter_init(&i, WRITE, iov, nr_segs, count);
1211 mutex_lock(&inode->i_mutex); 1206 mutex_lock(&inode->i_mutex);
1212 1207
1213 /* We can write back this queue in page reclaim */ 1208 /* We can write back this queue in page reclaim */
@@ -1220,7 +1215,7 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
1220 if (count == 0) 1215 if (count == 0)
1221 goto out; 1216 goto out;
1222 1217
1223 iov_iter_truncate(&i, count); 1218 iov_iter_truncate(from, count);
1224 err = file_remove_suid(file); 1219 err = file_remove_suid(file);
1225 if (err) 1220 if (err)
1226 goto out; 1221 goto out;
@@ -1230,13 +1225,13 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
1230 goto out; 1225 goto out;
1231 1226
1232 if (file->f_flags & O_DIRECT) { 1227 if (file->f_flags & O_DIRECT) {
1233 written = generic_file_direct_write(iocb, &i, pos); 1228 written = generic_file_direct_write(iocb, from, pos);
1234 if (written < 0 || !iov_iter_count(&i)) 1229 if (written < 0 || !iov_iter_count(from))
1235 goto out; 1230 goto out;
1236 1231
1237 pos += written; 1232 pos += written;
1238 1233
1239 written_buffered = fuse_perform_write(file, mapping, &i, pos); 1234 written_buffered = fuse_perform_write(file, mapping, from, pos);
1240 if (written_buffered < 0) { 1235 if (written_buffered < 0) {
1241 err = written_buffered; 1236 err = written_buffered;
1242 goto out; 1237 goto out;
@@ -1255,7 +1250,7 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
1255 written += written_buffered; 1250 written += written_buffered;
1256 iocb->ki_pos = pos + written_buffered; 1251 iocb->ki_pos = pos + written_buffered;
1257 } else { 1252 } else {
1258 written = fuse_perform_write(file, mapping, &i, pos); 1253 written = fuse_perform_write(file, mapping, from, pos);
1259 if (written >= 0) 1254 if (written >= 0)
1260 iocb->ki_pos = pos + written; 1255 iocb->ki_pos = pos + written;
1261 } 1256 }
@@ -3039,8 +3034,8 @@ static const struct file_operations fuse_file_operations = {
3039 .llseek = fuse_file_llseek, 3034 .llseek = fuse_file_llseek,
3040 .read = new_sync_read, 3035 .read = new_sync_read,
3041 .read_iter = fuse_file_read_iter, 3036 .read_iter = fuse_file_read_iter,
3042 .write = do_sync_write, 3037 .write = new_sync_write,
3043 .aio_write = fuse_file_aio_write, 3038 .write_iter = fuse_file_write_iter,
3044 .mmap = fuse_file_mmap, 3039 .mmap = fuse_file_mmap,
3045 .open = fuse_open, 3040 .open = fuse_open,
3046 .flush = fuse_flush, 3041 .flush = fuse_flush,