History

mm: document and polish read-ahead code

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.

NeilBrown committed 4 years ago

Commit 84dacdb1 parent bf507034 files · +133 −10Browse files

Showing the changes to include (1 of 4 files). Show all

Unified · Split

include/linux/fs.h+7−2
@@ -930,10 +930,15 @@ struct fown_struct { · 929 unmodified lines
930930 * struct file_ra_state - Track a file's readahead state.
931931 * @start: Where the most recent readahead started.
932932 * @size: Number of pages read in the most recent readahead.
933− * @async_size: Start next readahead when this many pages are left.
934− * @ra_pages: Maximum size of a readahead request.
933+ * @async_size: Numer of pages that were/are not needed immediately
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.
935937 * @mmap_miss: How many mmap accesses missed in the page cache.
936938 * @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.
937942 */
938943 struct file_ra_state {
939944 pgoff_t start;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t