Add some "big-picture" documentation for read-ahead and polish the code to make it fit this documentation. The meaning of ->async_size is clarified to match its name. i.e. Any request to ->readahead() has a sync part and an async part. The caller will wait for the sync pages to complete, but will not wait for the async pages. The first async page is still marked PG_readahead Note that the current function names page_cache_sync_ra() and page_cache_async_ra() are misleading. All ra request are partly sync and partly async, so either part can be empty. A page_cache_sync_ra() request will usually set ->async_size non-zero, implying it is not all synchronous. When a non-zero req_count is passed to page_cache_async_ra(), the implication is that some prefix of the request is synchronous, though the calculation made there is incorrect - I haven't tried to fix it.
Showing the changes to include (1 of 4 files). Show all
Unified · Split
| @@ -930,10 +930,15 @@ struct fown_struct { · 929 unmodified lines | |||
| 930 | * struct file_ra_state - Track a file's readahead state. | 930 | * struct file_ra_state - Track a file's readahead state. |
| 931 | * @start: Where the most recent readahead started. | 931 | * @start: Where the most recent readahead started. |
| 932 | * @size: Number of pages read in the most recent readahead. | 932 | * @size: Number of pages read in the most recent readahead. |
| 933 | * @async_size: Start next readahead when this many pages are left. | 933 | * @async_size: Numer of pages that were/are not needed immediately |
| 934 | * @ra_pages: Maximum size of a readahead request. | 934 | * and so were/are genuinely "ahead". Start next readahead when |
| 935 | * the first of these pages is accessed. | ||
| 936 | * @ra_pages: Maximum size of a readahead request, copied from the bdi. | ||
| 935 | * @mmap_miss: How many mmap accesses missed in the page cache. | 937 | * @mmap_miss: How many mmap accesses missed in the page cache. |
| 936 | * @prev_pos: The last byte in the most recent read request. | 938 | * @prev_pos: The last byte in the most recent read request. |
| 939 | * | ||
| 940 | * When this structure is passed to ->readahead(), the "most recent" | ||
| 941 | * readahead means the current readahead. | ||
| 937 | */ | 942 | */ |
| 938 | struct file_ra_state { | 943 | struct file_ra_state { |
| 939 | pgoff_t start; | 944 | pgoff_t start; |