Re: [PATCH v2] erofs: support splice() in inode_share mode

Chao Yu <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.ozlabs.lists.linux-erofs
Message-ID <[email protected]>
On 8/21/26 09:56, Zhan Xusheng wrote:
> From: Zhan Xusheng <[email protected]>
> 
> From: Zhan Xusheng <[email protected]>
> 
> erofs_ishare_fops routes everything that touches the page cache to the
> backing file in ->private_data: read_iter clones the iocb onto it, mmap
> does vma_set_file(), fadvise calls vfs_fadvise() on it.  splice_read was
> left as filemap_splice_read(), which works on the user file's own mapping:
> it does init_sync_kiocb(&iocb, in), and filemap_get_pages() then takes
> iocb->ki_filp->f_mapping.
> 
> So splice() and sendfile() fill the per-inode page cache rather than the
> shared one.  The content is the same either way, since erofs_fill_inode()
> sets a_ops on that mapping too, which is why this went unnoticed.  Two
> identical 8 MiB files under inode_share, reading one of them with splice(2)
> alone, in pages:
> 
>    before   own 2048   shared 0
>    after    own 0      shared 2048
> 
> "own" is cachestat(fd), which reports the file's own mapping; "shared" is
> mmap()+mincore(), which erofs_ishare_mmap() redirects to the backing file.
> 
> Read through the backing file, as read_iter already does.
> 
> Link: https://lore.kernel.org/all/[email protected]/
> Signed-off-by: Zhan Xusheng <[email protected]>

Reviewed-by: Chao Yu <[email protected]>

Thanks,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.