diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-22 06:57:37 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-06 17:32:54 -0400 |
commit | 37938463540b075e9166cf774c59274379f7a8ca (patch) | |
tree | d264115725c6a6a6bada139fa04369389ce889fe /fs/block_dev.c | |
parent | 0c949334a9e2581646c6ff0d1470a805b1e5be99 (diff) |
blkdev_aio_read(): switch to generic_file_read_iter(), get rid of iov_shorten()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 937e3011ed58..b140badb8184 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1538,14 +1538,17 @@ static ssize_t blkdev_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
1538 | struct file *file = iocb->ki_filp; | 1538 | struct file *file = iocb->ki_filp; |
1539 | struct inode *bd_inode = file->f_mapping->host; | 1539 | struct inode *bd_inode = file->f_mapping->host; |
1540 | loff_t size = i_size_read(bd_inode); | 1540 | loff_t size = i_size_read(bd_inode); |
1541 | size_t count = iocb->ki_nbytes; | ||
1542 | struct iov_iter to; | ||
1543 | |||
1544 | iov_iter_init(&to, READ, iov, nr_segs, count); | ||
1541 | 1545 | ||
1542 | if (pos >= size) | 1546 | if (pos >= size) |
1543 | return 0; | 1547 | return 0; |
1544 | 1548 | ||
1545 | size -= pos; | 1549 | size -= pos; |
1546 | if (size < iocb->ki_nbytes) | 1550 | iov_iter_truncate(&to, size); |
1547 | nr_segs = iov_shorten((struct iovec *)iov, nr_segs, size); | 1551 | return generic_file_read_iter(iocb, &to); |
1548 | return generic_file_aio_read(iocb, iov, nr_segs, pos); | ||
1549 | } | 1552 | } |
1550 | 1553 | ||
1551 | /* | 1554 | /* |