In generic_file_readahead():
unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT;
unsigned long index = page->index;
...
max_ahead = 0;
...
raend = index;
if (raend < end_index)
max_ahead = filp->f_ramax;
and later
ahead = 0;
while (ahead < max_ahead) {
ahead ++;
if ((raend + ahead) >= end_index)
break;
if (page_cache_read(filp, raend + ahead) < 0)
break;
}
AFAICS it means that we have off-by-partial here - if the file size is not
a multiple of PAGE_CACHE_SIZE we are missing the last page. Proposed
fix:
make end_index = (inode->i_size + PAGE_CACHE_SIZE - 1)>>PAGE_CACHE_SHIFT;
Objections?
PS: folks, could those who wrote that function comment on the readahead
rules in general? This stuff looks really ugly (presumably from the layers
and layers of small modifications) and comments on _intentions_ of that
code (as opposed to "what are we doing in the next two lines") would be
very welcome.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Oct 31 2000 - 21:00:15 EST