diff options
author | Christoph Hellwig <hch@lst.de> | 2017-08-29 10:13:18 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-09-04 19:04:22 -0400 |
commit | 47c27bc46946dea543196a92061da14c6da9889e (patch) | |
tree | 905d286c9435e0c09ff93dc120ec9c8a11efee63 | |
parent | cc4a41fe5541a73019a864883297bd5043aa6d98 (diff) |
fs: pass iocb to do_generic_file_read
And rename it to the more descriptive generic_file_buffered_read while
at it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | mm/filemap.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 0b41c8cbeabc..b7c039669020 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1888,9 +1888,8 @@ static void shrink_readahead_size_eio(struct file *filp, | |||
1888 | } | 1888 | } |
1889 | 1889 | ||
1890 | /** | 1890 | /** |
1891 | * do_generic_file_read - generic file read routine | 1891 | * generic_file_buffered_read - generic file read routine |
1892 | * @filp: the file to read | 1892 | * @iocb: the iocb to read |
1893 | * @ppos: current file position | ||
1894 | * @iter: data destination | 1893 | * @iter: data destination |
1895 | * @written: already copied | 1894 | * @written: already copied |
1896 | * | 1895 | * |
@@ -1900,12 +1899,14 @@ static void shrink_readahead_size_eio(struct file *filp, | |||
1900 | * This is really ugly. But the goto's actually try to clarify some | 1899 | * This is really ugly. But the goto's actually try to clarify some |
1901 | * of the logic when it comes to error handling etc. | 1900 | * of the logic when it comes to error handling etc. |
1902 | */ | 1901 | */ |
1903 | static ssize_t do_generic_file_read(struct file *filp, loff_t *ppos, | 1902 | static ssize_t generic_file_buffered_read(struct kiocb *iocb, |
1904 | struct iov_iter *iter, ssize_t written) | 1903 | struct iov_iter *iter, ssize_t written) |
1905 | { | 1904 | { |
1905 | struct file *filp = iocb->ki_filp; | ||
1906 | struct address_space *mapping = filp->f_mapping; | 1906 | struct address_space *mapping = filp->f_mapping; |
1907 | struct inode *inode = mapping->host; | 1907 | struct inode *inode = mapping->host; |
1908 | struct file_ra_state *ra = &filp->f_ra; | 1908 | struct file_ra_state *ra = &filp->f_ra; |
1909 | loff_t *ppos = &iocb->ki_pos; | ||
1909 | pgoff_t index; | 1910 | pgoff_t index; |
1910 | pgoff_t last_index; | 1911 | pgoff_t last_index; |
1911 | pgoff_t prev_index; | 1912 | pgoff_t prev_index; |
@@ -2153,14 +2154,14 @@ out: | |||
2153 | ssize_t | 2154 | ssize_t |
2154 | generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) | 2155 | generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) |
2155 | { | 2156 | { |
2156 | struct file *file = iocb->ki_filp; | ||
2157 | ssize_t retval = 0; | ||
2158 | size_t count = iov_iter_count(iter); | 2157 | size_t count = iov_iter_count(iter); |
2158 | ssize_t retval = 0; | ||
2159 | 2159 | ||
2160 | if (!count) | 2160 | if (!count) |
2161 | goto out; /* skip atime */ | 2161 | goto out; /* skip atime */ |
2162 | 2162 | ||
2163 | if (iocb->ki_flags & IOCB_DIRECT) { | 2163 | if (iocb->ki_flags & IOCB_DIRECT) { |
2164 | struct file *file = iocb->ki_filp; | ||
2164 | struct address_space *mapping = file->f_mapping; | 2165 | struct address_space *mapping = file->f_mapping; |
2165 | struct inode *inode = mapping->host; | 2166 | struct inode *inode = mapping->host; |
2166 | loff_t size; | 2167 | loff_t size; |
@@ -2201,7 +2202,7 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) | |||
2201 | goto out; | 2202 | goto out; |
2202 | } | 2203 | } |
2203 | 2204 | ||
2204 | retval = do_generic_file_read(file, &iocb->ki_pos, iter, retval); | 2205 | retval = generic_file_buffered_read(iocb, iter, retval); |
2205 | out: | 2206 | out: |
2206 | return retval; | 2207 | return retval; |
2207 | } | 2208 | } |