On Tue, Feb 28, 2017 at 05:36:05PM -0600, Goldwyn Rodrigues wrote: > Find out if the write will trigger a wait due to writeback. If yes, > return -EAGAIN. > > This introduces a new function filemap_range_has_page() which > returns true if the file's mapping has a page within the range > mentioned. Ugh, this is pretty inefficient. If that's all you want to know, then using the radix tree directly will be far more efficient than spinning up all the pagevec machinery only to discard the pages found. But what's going to kick these pages out of cache? Shouldn't we rather find the pages, kick them out if clean, start writeback if not, and *then* return -EAGAIN? So maybe we want to spin up the pagevec machinery after all so we can do that extra work?