diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-04-02 20:00:02 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-06 17:37:58 -0400 |
commit | 2ba5bbed0cd7429dbd567fa885ae3bc7a76de3d4 (patch) | |
tree | 5ab52803f626696845dbface804d6b1a7de3f79f /mm/shmem.c | |
parent | fb9096a344e2964c6a71520931c08abb1301248e (diff) |
shmem: switch to ->read_iter()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index e0b76696c3f9..edc6c7e817e9 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1402,8 +1402,7 @@ shmem_write_end(struct file *file, struct address_space *mapping, | |||
1402 | return copied; | 1402 | return copied; |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | static ssize_t shmem_file_aio_read(struct kiocb *iocb, | 1405 | static ssize_t shmem_file_read_iter(struct kiocb *iocb, struct iov_iter *to) |
1406 | const struct iovec *iov, unsigned long nr_segs, loff_t pos) | ||
1407 | { | 1406 | { |
1408 | struct file *file = iocb->ki_filp; | 1407 | struct file *file = iocb->ki_filp; |
1409 | struct inode *inode = file_inode(file); | 1408 | struct inode *inode = file_inode(file); |
@@ -1413,11 +1412,7 @@ static ssize_t shmem_file_aio_read(struct kiocb *iocb, | |||
1413 | enum sgp_type sgp = SGP_READ; | 1412 | enum sgp_type sgp = SGP_READ; |
1414 | int error = 0; | 1413 | int error = 0; |
1415 | ssize_t retval = 0; | 1414 | ssize_t retval = 0; |
1416 | size_t count = iov_length(iov, nr_segs); | ||
1417 | loff_t *ppos = &iocb->ki_pos; | 1415 | loff_t *ppos = &iocb->ki_pos; |
1418 | struct iov_iter iter; | ||
1419 | |||
1420 | iov_iter_init(&iter, READ, iov, nr_segs, count); | ||
1421 | 1416 | ||
1422 | /* | 1417 | /* |
1423 | * Might this read be for a stacking filesystem? Then when reading | 1418 | * Might this read be for a stacking filesystem? Then when reading |
@@ -1493,14 +1488,14 @@ static ssize_t shmem_file_aio_read(struct kiocb *iocb, | |||
1493 | * Ok, we have the page, and it's up-to-date, so | 1488 | * Ok, we have the page, and it's up-to-date, so |
1494 | * now we can copy it to user space... | 1489 | * now we can copy it to user space... |
1495 | */ | 1490 | */ |
1496 | ret = copy_page_to_iter(page, offset, nr, &iter); | 1491 | ret = copy_page_to_iter(page, offset, nr, to); |
1497 | retval += ret; | 1492 | retval += ret; |
1498 | offset += ret; | 1493 | offset += ret; |
1499 | index += offset >> PAGE_CACHE_SHIFT; | 1494 | index += offset >> PAGE_CACHE_SHIFT; |
1500 | offset &= ~PAGE_CACHE_MASK; | 1495 | offset &= ~PAGE_CACHE_MASK; |
1501 | 1496 | ||
1502 | page_cache_release(page); | 1497 | page_cache_release(page); |
1503 | if (!iov_iter_count(&iter)) | 1498 | if (!iov_iter_count(to)) |
1504 | break; | 1499 | break; |
1505 | if (ret < nr) { | 1500 | if (ret < nr) { |
1506 | error = -EFAULT; | 1501 | error = -EFAULT; |
@@ -2622,9 +2617,9 @@ static const struct file_operations shmem_file_operations = { | |||
2622 | .mmap = shmem_mmap, | 2617 | .mmap = shmem_mmap, |
2623 | #ifdef CONFIG_TMPFS | 2618 | #ifdef CONFIG_TMPFS |
2624 | .llseek = shmem_file_llseek, | 2619 | .llseek = shmem_file_llseek, |
2625 | .read = do_sync_read, | 2620 | .read = new_sync_read, |
2626 | .write = do_sync_write, | 2621 | .write = do_sync_write, |
2627 | .aio_read = shmem_file_aio_read, | 2622 | .read_iter = shmem_file_read_iter, |
2628 | .aio_write = generic_file_aio_write, | 2623 | .aio_write = generic_file_aio_write, |
2629 | .fsync = noop_fsync, | 2624 | .fsync = noop_fsync, |
2630 | .splice_read = shmem_file_splice_read, | 2625 | .splice_read = shmem_file_splice_read, |