Re: [PATCH v5 4/5] cramfs: add mmap support

2017-10-06 Thread Nicolas Pitre
On Fri, 6 Oct 2017, Christoph Hellwig wrote: > > + /* Don't map the last page if it contains some other data */ > > + if (unlikely(pgoff + pages == max_pages)) { > > + unsigned int partial = offset_in_page(inode->i_size); > > + if (partial) { > > + char *d

Re: [PATCH v5 4/5] cramfs: add mmap support

2017-10-06 Thread Christoph Hellwig
> + /* Don't map the last page if it contains some other data */ > + if (unlikely(pgoff + pages == max_pages)) { > + unsigned int partial = offset_in_page(inode->i_size); > + if (partial) { > + char *data = sbi->linear_virt_addr + offset; > +

[PATCH v5 4/5] cramfs: add mmap support

2017-10-05 Thread Nicolas Pitre
When cramfs_physmem is used then we have the opportunity to map files directly from ROM, directly into user space, saving on RAM usage. This gives us Execute-In-Place (XIP) support. For a file to be mmap()-able, the map area has to correspond to a range of uncompressed and contiguous blocks, and i