Messages in this thread | | | Date | Wed, 25 Oct 2000 11:41:21 -0600 | From | "Jeff V. Merkey" <> | Subject | Re: [potential bug] generic_file_readahead() |
| |
Rik,
Ok, I understand what you're doing now. How is this going to affect page cache based file systems.
Jeff
Rik van Riel wrote: > > On Wed, 25 Oct 2000, Alexander Viro wrote: > > > 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? > > Indeed, this should fix another inefficiency in the > readahead code. I'll prepare a patch for filemap.c > soon (also containing ANOTHER small fix to the > readahead code). > > > 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. > > While I haven't written it, I'll try to come up with > some documentation when I have the time (yeah right). > Oh well, I'll try to at least comment on everything _I_ > try to change in the kernel ;) > > regards, > > Rik > -- > "What you're running that piece of shit Gnome?!?!" > -- Miguel de Icaza, UKUUG 2000 > > http://www.conectiva.com/ http://www.surriel.com/ > > - > 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/ - 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/
| |