On Tue, Aug 20, 2019 at 01:50:30PM +0100, David Howells wrote: > Carlos Maiolino <cmaiolino@xxxxxxxxxx> wrote: > > > > > + block = page->index; > > > > + block <<= shift; > > > > > > Can't this cause overflows? > > > > Hmm, I honestly don't know. I did look at the code, and I couldn't really spot > > anything concrete. > > Maybe, though we'd have to support file sizes over 16 Exabytes for that to be > a problem. On 32-bit sysems page->index is a 32-bit value, so you'd overflow at pretty normal sizes of a few TB. > Note that bmap() is *only* used to find out if the page is present in the > cache - and even that I'm not actually doing very well, since I really *ought* > to check every block in the page. > > I really want to replace the use of bmap entirely with iov_iter doing DIO. > Cachefiles currently does double buffering because it works through the > pagecache of the underlying to do actual read or write - and this appears to > cause memory management problems. Not related to this patch, but using iov_iter with dio is trivial, what is the blocker therere?