Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69596
b: refs/heads/master
c: 6b10c6c
h: refs/heads/master
v: v3
  • Loading branch information
Fengguang Wu authored and Linus Torvalds committed Oct 16, 2007
1 parent a37656b commit 560c587
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6df8ba4f8a4c4abca9ccad10441d0dddbdff301c
refs/heads/master: 6b10c6c9fbfe754e8482efb8c8b84f8e40c0f2eb
33 changes: 23 additions & 10 deletions trunk/mm/readahead.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,29 @@ ondemand_readahead(struct address_space *mapping,
offset, req_size, 0);
}

/*
* Hit a marked page without valid readahead state.
* E.g. interleaved reads.
* Query the pagecache for async_size, which normally equals to
* readahead size. Ramp it up and use it as the new readahead size.
*/
if (hit_readahead_marker) {
pgoff_t start;

read_lock_irq(&mapping->tree_lock);
start = radix_tree_next_hole(&mapping->page_tree, offset, max+1);
read_unlock_irq(&mapping->tree_lock);

if (!start || start - offset > max)
return 0;

ra->start = start;
ra->size = start - offset; /* old async_size */
ra->size = get_next_ra_size(ra, max);
ra->async_size = ra->size;
goto readit;
}

/*
* It may be one of
* - first read on start of file
Expand All @@ -390,16 +413,6 @@ ondemand_readahead(struct address_space *mapping,
ra->size = get_init_ra_size(req_size, max);
ra->async_size = ra->size > req_size ? ra->size - req_size : ra->size;

/*
* Hit on a marked page without valid readahead state.
* E.g. interleaved reads.
* Not knowing its readahead pos/size, bet on the minimal possible one.
*/
if (hit_readahead_marker) {
ra->start++;
ra->size = get_next_ra_size(ra, max);
}

readit:
return ra_submit(ra, mapping, filp);
}
Expand Down

0 comments on commit 560c587

Please sign in to comment.