Commit 37938463 authored by Al Viro's avatar Al Viro

blkdev_aio_read(): switch to generic_file_read_iter(), get rid of iov_shorten()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0c949334
...@@ -1538,14 +1538,17 @@ static ssize_t blkdev_aio_read(struct kiocb *iocb, const struct iovec *iov, ...@@ -1538,14 +1538,17 @@ static ssize_t blkdev_aio_read(struct kiocb *iocb, const struct iovec *iov,
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *bd_inode = file->f_mapping->host; struct inode *bd_inode = file->f_mapping->host;
loff_t size = i_size_read(bd_inode); 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) if (pos >= size)
return 0; return 0;
size -= pos; size -= pos;
if (size < iocb->ki_nbytes) iov_iter_truncate(&to, size);
nr_segs = iov_shorten((struct iovec *)iov, nr_segs, size); return generic_file_read_iter(iocb, &to);
return generic_file_aio_read(iocb, iov, nr_segs, pos);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment