On Thu, Oct 29, 2020 at 08:19:09PM -0400, Kent Overstreet wrote: > On Thu, Oct 29, 2020 at 07:33:53PM +0000, Matthew Wilcox (Oracle) wrote: > > Add mapping_get_read_heads() which returns the head pages which > > represent a contiguous array of bytes in the file. It also stops > > when encountering a page marked as Readahead or !Uptodate (but > > does return that page) so it can be handled appropriately by > > gfbr_get_pages(). > > I don't like the _heads naming - this is like find_get_pages_contig() except it > returns compound pages instead of single pages, and the naming should reflect > that. And, working with compound pages should be the default in the future - > code working with individual pages should be considered a code smell in the > future, i.e. find_get_pages() et. all. should be considered deprecated. You're right. It should just be called mapping_get_(something)_thps. > Also - you're implementing new core functionality with a pecularity of the read > path, the two probably be split out. Perhaps find_get_cpages (compound_pages) > that can also be passed a stop condition. It isn't clear to me _how_ to do that, so in the absence of that obvious, I decided to implement what we need right now, and we can figure out how to abstract it later. So until we have a better idea, I'm going with "read" for the (something) above. > > + if (writably_mapped) { > > + int j; > > + > > + for (j = 0; j < thp_nr_pages(page); j++) > > + flush_dcache_page(page + j); > > + } > > this should be a new helper Good point. One flush_dcache_thp() coming right up!