| Function report | 
| Source Code: mm\filemap.c | Create Date:2022-07-28 14:02:19 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:generic_file_buffered_read - generic file read routine*@iocb: the iocb to read*@iter: data destination*@written: already copied* This is a generic file read routine, and uses the* mapping->a_ops->readpage() function for the actual low-level stuff.
Proto:static ssize_t generic_file_buffered_read(struct kiocb *iocb, struct iov_iter *iter, ssize_t written)
Type:ssize_t
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct kiocb * | iocb | |
| struct iov_iter * | iter | |
| ssize_t | written | 
| 2022 | error = 0 | 
| 2024 | If Value for the false possibility is greater at compile time( * ppos >= s_maxbytes) Then Return 0 | 
| 2028 | index = ppos >> PAGE_SHIFT determines the page size | 
| 2030 | prev_offset = Cache last read() position & PAGE_SIZE - 1 | 
| 2031 | last_index = ppos + count + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size | 
| 2034 | cycle | 
| 2040 | cond_resched() | 
| 2041 | find_page : | 
| 2042 | If fatal_signal_pending(current process) Then | 
| 2048 | If Not page Then | 
| 2049 | If ki_flags & IOCB_NOWAIT Then Go to would_block | 
| 2051 | page_cache_sync_readahead(mapping, ra, filp, index, last_index - index) | 
| 2055 | If Value for the false possibility is greater at compile time(page == NULL) Then Go to no_cached_page | 
| 2058 | If PageReadahead(page) Then | 
| 2059 | page_cache_async_readahead(mapping, ra, filp, page, index, last_index - index) | 
| 2063 | If Not PageUptodate(page) Then | 
| 2064 | If ki_flags & IOCB_NOWAIT Then | 
| 2066 | Go to would_block | 
| 2074 | error = wait_on_page_locked_killable(page) | 
| 2075 | If Value for the false possibility is greater at compile time(error) Then Go to readpage_error | 
| 2077 | If PageUptodate(page) Then Go to page_ok | 
| 2080 | If i_blkbits == PAGE_SHIFT determines the page size || Not is_partially_uptodate Then Go to page_not_up_to_date | 
| 2084 | If Value for the false possibility is greater at compile time(iov_iter_is_pipe(iter)) Then Go to page_not_up_to_date | 
| 2086 | If Not Return true if the page was successfully locked Then Go to page_not_up_to_date | 
| 2089 | If Not See page-flags.h for PAGE_MAPPING_FLAGS Then Go to page_not_up_to_date_locked | 
| 2091 | If Not is_partially_uptodate(page, offset, count) Then Go to page_not_up_to_date_locked | 
| 2096 | page_ok : | 
| 2107 | end_index = isize - 1 >> PAGE_SHIFT determines the page size | 
| 2108 | If Value for the false possibility is greater at compile time(!isize || index > end_index) Then | 
| 2135 | If prev_index != index || offset != prev_offset Then mark_page_accessed(page) | 
| 2137 | prev_index = index | 
| 2146 | index += offset >> PAGE_SHIFT determines the page size | 
| 2148 | prev_offset = offset | 
| 2152 | If Not iov_iter_count(iter) Then Go to out | 
| 2158 | Continue | 
| 2160 | page_not_up_to_date : | 
| 2162 | error = lock_page_killable is like lock_page but can be interrupted by fatal* signals. It returns 0 if it locked the page and -EINTR if it was* killed while waiting. | 
| 2163 | If Value for the false possibility is greater at compile time(error) Then Go to readpage_error | 
| 2166 | page_not_up_to_date_locked : | 
| 2168 | If Not See page-flags.h for PAGE_MAPPING_FLAGS Then | 
| 2171 | Continue | 
| 2175 | If PageUptodate(page) Then | 
| 2177 | Go to page_ok | 
| 2180 | readpage : | 
| 2186 | ClearPageError(page) | 
| 2191 | If error == AOP_TRUNCATED_PAGE Then | 
| 2196 | Go to readpage_error | 
| 2199 | If Not PageUptodate(page) Then | 
| 2200 | error = lock_page_killable is like lock_page but can be interrupted by fatal* signals. It returns 0 if it locked the page and -EINTR if it was* killed while waiting. | 
| 2201 | If Value for the false possibility is greater at compile time(error) Then Go to readpage_error | 
| 2203 | If Not PageUptodate(page) Then | 
| 2204 | If ( See page-flags.h for PAGE_MAPPING_FLAGS == NULL) Then | 
| 2210 | Go to find_page | 
| 2215 | Go to readpage_error | 
| 2220 | Go to page_ok | 
| 2222 | readpage_error : | 
| 2225 | Go to out | 
| 2227 | no_cached_page : | 
| 2232 | page = page_cache_alloc(mapping) | 
| 2233 | If Not page Then | 
| 2237 | error = add_to_page_cache_lru(page, mapping, index, Restricts the given gfp_mask to what the mapping allows. ) | 
| 2239 | If error Then | 
| 2245 | Go to out | 
| 2247 | Go to readpage | 
| 2250 | would_block : | 
| 2252 | out : | 
| 2257 | ppos = (index << PAGE_SHIFT determines the page size ) + offset | 
| 2258 | file_accessed(filp) | 
| Name | Describe | 
|---|---|
| generic_file_read_iter | generic_file_read_iter - generic filesystem read routine*@iocb: kernel I/O control block*@iter: destination for the data read* This is the "read_iter()" routine for all filesystems* that can use the page cache directly | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |