Read-ahead code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I guess I found a bug in the readahead code, kernel 2.6.7.
In filemap_nopage, if the memory area is not marked as sequential (VM_SEQ_READ isn't set) and the page is not in the page cache, the following code is executed:


1 ra_pages = max_sane_readahead(file->f_ra.ra_pages);
2 if (ra_pages) {
3 long start;
4
5 start = pgoff - ra_pages / 2;
6 if (pgoff < 0)
7 pgoff = 0;
8 do_page_cache_readahead(mapping, file, pgoff, ra_pages);
9 }


Seems that the author wanted to read ra_pages around pgoff. Shouldn't it be using 'start' instead of 'pgoff' in lines 6 to 8?!? Start is calculated and never used. Instead of reading pages from start to pgoff + ra_pages/2, it's reading ra_pages from pgoff.

	Luciano

--
Luciano A. Stertz
luciano@xxxxxxxxxxxx
T&T Engenheiros Associados Ltda
http://www.tteng.com.br-
Fone/Fax (51) 3224 8425

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux