diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-10 14:08:45 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-06 17:32:47 -0400 |
commit | 26978b8b4d83c46f4310b253db70fa9e65149e7c (patch) | |
tree | a080f083ccf61b949e41699f2d20f7efffce9114 /mm/filemap.c | |
parent | 31b140398ce56ab41646eda7f02bcb78d6a4c916 (diff) |
give ->direct_IO() a copy of iov_iter
the thing is, we want to advance what's given to ->direct_IO() as we
are forming the request; however, the callers care about the amount
of data actually transferred, not the amount we tried to transfer.
It's more convenient to allow ->direct_IO() instances do use
iov_iter_advance() on the copy of iov_iter, leaving the actual
advancing of the original to caller.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 70c048ea36e0..866f4ae8223b 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1699,8 +1699,10 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
1699 | size = i_size_read(inode); | 1699 | size = i_size_read(inode); |
1700 | retval = filemap_write_and_wait_range(mapping, pos, | 1700 | retval = filemap_write_and_wait_range(mapping, pos, |
1701 | pos + count - 1); | 1701 | pos + count - 1); |
1702 | if (!retval) | 1702 | if (!retval) { |
1703 | retval = mapping->a_ops->direct_IO(READ, iocb, &i, pos); | 1703 | struct iov_iter data = i; |
1704 | retval = mapping->a_ops->direct_IO(READ, iocb, &data, pos); | ||
1705 | } | ||
1704 | 1706 | ||
1705 | if (retval > 0) { | 1707 | if (retval > 0) { |
1706 | *ppos = pos + retval; | 1708 | *ppos = pos + retval; |
@@ -2351,6 +2353,7 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from, | |||
2351 | ssize_t written; | 2353 | ssize_t written; |
2352 | size_t write_len; | 2354 | size_t write_len; |
2353 | pgoff_t end; | 2355 | pgoff_t end; |
2356 | struct iov_iter data; | ||
2354 | 2357 | ||
2355 | if (count != ocount) | 2358 | if (count != ocount) |
2356 | from->nr_segs = iov_shorten((struct iovec *)from->iov, from->nr_segs, count); | 2359 | from->nr_segs = iov_shorten((struct iovec *)from->iov, from->nr_segs, count); |
@@ -2382,7 +2385,8 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from, | |||
2382 | } | 2385 | } |
2383 | } | 2386 | } |
2384 | 2387 | ||
2385 | written = mapping->a_ops->direct_IO(WRITE, iocb, from, pos); | 2388 | data = *from; |
2389 | written = mapping->a_ops->direct_IO(WRITE, iocb, &data, pos); | ||
2386 | 2390 | ||
2387 | /* | 2391 | /* |
2388 | * Finally, try again to invalidate clean pages which might have been | 2392 | * Finally, try again to invalidate clean pages which might have been |