aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-03-03 22:03:20 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-05-06 17:32:42 -0400
commitf8579f8673b7ecdb7a81d5d5bb1d981093d9aa94 (patch)
treed4287d0dffbf3758e709238302fb8865cdd66651 /mm/filemap.c
parente7c24607b5d68a4cdc56e09d70a3c8bae5f0519f (diff)
generic_file_direct_write(): switch to iov_iter
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 000a220e2a41..a840890ed39f 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2385,9 +2385,8 @@ int pagecache_write_end(struct file *file, struct address_space *mapping,
2385EXPORT_SYMBOL(pagecache_write_end); 2385EXPORT_SYMBOL(pagecache_write_end);
2386 2386
2387ssize_t 2387ssize_t
2388generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov, 2388generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from,
2389 unsigned long *nr_segs, loff_t pos, 2389 loff_t pos, size_t count, size_t ocount)
2390 size_t count, size_t ocount)
2391{ 2390{
2392 struct file *file = iocb->ki_filp; 2391 struct file *file = iocb->ki_filp;
2393 struct address_space *mapping = file->f_mapping; 2392 struct address_space *mapping = file->f_mapping;
@@ -2397,9 +2396,9 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
2397 pgoff_t end; 2396 pgoff_t end;
2398 2397
2399 if (count != ocount) 2398 if (count != ocount)
2400 *nr_segs = iov_shorten((struct iovec *)iov, *nr_segs, count); 2399 from->nr_segs = iov_shorten((struct iovec *)from->iov, from->nr_segs, count);
2401 2400
2402 write_len = iov_length(iov, *nr_segs); 2401 write_len = iov_length(from->iov, from->nr_segs);
2403 end = (pos + write_len - 1) >> PAGE_CACHE_SHIFT; 2402 end = (pos + write_len - 1) >> PAGE_CACHE_SHIFT;
2404 2403
2405 written = filemap_write_and_wait_range(mapping, pos, pos + write_len - 1); 2404 written = filemap_write_and_wait_range(mapping, pos, pos + write_len - 1);
@@ -2426,7 +2425,7 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
2426 } 2425 }
2427 } 2426 }
2428 2427
2429 written = mapping->a_ops->direct_IO(WRITE, iocb, iov, pos, *nr_segs); 2428 written = mapping->a_ops->direct_IO(WRITE, iocb, from->iov, pos, from->nr_segs);
2430 2429
2431 /* 2430 /*
2432 * Finally, try again to invalidate clean pages which might have been 2431 * Finally, try again to invalidate clean pages which might have been
@@ -2443,6 +2442,7 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
2443 2442
2444 if (written > 0) { 2443 if (written > 0) {
2445 pos += written; 2444 pos += written;
2445 iov_iter_advance(from, written);
2446 if (pos > i_size_read(inode) && !S_ISBLK(inode->i_mode)) { 2446 if (pos > i_size_read(inode) && !S_ISBLK(inode->i_mode)) {
2447 i_size_write(inode, pos); 2447 i_size_write(inode, pos);
2448 mark_inode_dirty(inode); 2448 mark_inode_dirty(inode);
@@ -2645,11 +2645,10 @@ ssize_t __generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
2645 if (unlikely(file->f_flags & O_DIRECT)) { 2645 if (unlikely(file->f_flags & O_DIRECT)) {
2646 loff_t endbyte; 2646 loff_t endbyte;
2647 2647
2648 written = generic_file_direct_write(iocb, iov, &from.nr_segs, pos, 2648 written = generic_file_direct_write(iocb, &from, pos,
2649 count, ocount); 2649 count, ocount);
2650 if (written < 0 || written == count) 2650 if (written < 0 || written == count)
2651 goto out; 2651 goto out;
2652 iov_iter_advance(&from, written);
2653 2652
2654 /* 2653 /*
2655 * direct-io write to a hole: fall through to buffered I/O 2654 * direct-io write to a hole: fall through to buffered I/O