blkdev_aio_read(): switch to generic_file_read_iter(), get rid of iov_shorten()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 22 Mar 2014 10:57:37 +0000 (06:57 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 6 May 2014 21:32:54 +0000 (17:32 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/block_dev.c

index 937e3011ed58d80c04312915f61b664435dd5427..b140badb8184cad9e56e3b0e9f383b38b371e950 100644 (file)
@@ -1538,14 +1538,17 @@ static ssize_t blkdev_aio_read(struct kiocb *iocb, const struct iovec *iov,
        struct file *file = iocb->ki_filp;
        struct inode *bd_inode = file->f_mapping->host;
        loff_t size = i_size_read(bd_inode);
+       size_t count = iocb->ki_nbytes;
+       struct iov_iter to;
+
+       iov_iter_init(&to, READ, iov, nr_segs, count);
 
        if (pos >= size)
                return 0;
 
        size -= pos;
-       if (size < iocb->ki_nbytes)
-               nr_segs = iov_shorten((struct iovec *)iov, nr_segs, size);
-       return generic_file_aio_read(iocb, iov, nr_segs, pos);
+       iov_iter_truncate(&to, size);
+       return generic_file_read_iter(iocb, &to);
 }
 
 /*