From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 178313A0B2E for ; Thu, 20 Aug 2026 09:53:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.98 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787219613; cv=none; b=bfEmP3vk99nUM08e853xnXCAcrQyx4r9tVEsOlYZQEOWwXHXj35v3P8Ij5AkImdvwmyH5oCS0Z0qUpGeFvsAEvUFndmH/mv9U3cLukhkko+awLre71iBgvuM6pWlhECeAo7B/nMGj2e3Y9mnhZj8eLYYLlsV++zqKB9iNkgbviY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787219613; c=relaxed/simple; bh=k4lxC0oSl1Bh0uAiw0Qa/6EmsMjcOsFaZrF3FNLjHp8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ElFe/R4o0Upyd0ZVGz63I6T2Q9UsYOzixo05HmNTyL2Jwe/a7ydkdjU9JPX/71qWT2dcCzP1GrN5XPLdyg/uYSq8VY7h0toTFKGKvr1Ukh9bp3owGM8ZRfq0xkr8tWLMzBgpAfuuKBJvLrm5IKRq+fkPBn78or6bfy/8lyY9i9A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=OyR7+O4z; arc=none smtp.client-ip=115.124.30.98 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="OyR7+O4z" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1787219601; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=krhkCUV/huoczaV3l16hDfp/ZVJBovEFX5MspQM9s5o=; b=OyR7+O4zV3VW1JJXVh0ZYXlVICAvuT1+75J5huiB4A311+/DcmzJIN+AqYZIaqqiKE6QadgJKR5TomJgV9aA/xyJHoxsb1Lyv57p0ZvLw9uJH30Wuw07o8LFswQvK/eMC9RAFrUDbwtvOA/KnMhDHSqFq0pHSEsSkuZZbDamMrU= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0X9J7cYn_1787219600; Received: from 30.221.151.40(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0X9J7cYn_1787219600 cluster:ay36) by smtp.aliyun-inc.com; Thu, 20 Aug 2026 17:53:21 +0800 Message-ID: <3d735f18-2d26-4b4c-be68-b000742e9826@linux.alibaba.com> Date: Thu, 20 Aug 2026 17:53:20 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] erofs: use the shared page cache for splice in inode_share mode To: Zhan Xusheng , Gao Xiang , Chao Yu Cc: zhanxusheng@xiaomi.com, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20260820064441.1083470-1-zhanxusheng@xiaomi.com> Content-Language: en-US From: Jingbo Xu In-Reply-To: <20260820064441.1083470-1-zhanxusheng@xiaomi.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 8/20/26 2:44 PM, Zhan Xusheng wrote: > From: Zhan Xusheng > > From: Zhan Xusheng > > 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. > > filemap_splice_read() does init_sync_kiocb(&iocb, in), and > filemap_get_pages() then takes iocb->ki_filp->f_mapping, so splice() and > sendfile() populate the per-file page cache from disk instead of using the > shared one. The data is correct, since erofs_fill_inode() sets that > mapping's a_ops either way, but the same content ends up cached twice, > which is what inode_share is there to avoid. > > Pass the backing file, as read_iter already does. > > Fixes: 5ef3208e3be5 ("erofs: introduce the page cache share feature") > Link: https://lore.kernel.org/all/b7dc7192-d586-45a2-bc4a-b41dc681c9bb@linux.alibaba.com/ > Signed-off-by: Zhan Xusheng > --- > fs/erofs/ishare.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/fs/erofs/ishare.c b/fs/erofs/ishare.c > index fa7d4112dec5..01dc53e9e3ad 100644 > --- a/fs/erofs/ishare.c > +++ b/fs/erofs/ishare.c > @@ -148,6 +148,13 @@ static int erofs_ishare_mmap(struct file *file, struct vm_area_struct *vma) > return generic_file_readonly_mmap(file, vma); > } > > +static ssize_t erofs_ishare_splice_read(struct file *in, loff_t *ppos, > + struct pipe_inode_info *pipe, > + size_t len, unsigned int flags) > +{ > + return filemap_splice_read(in->private_data, ppos, pipe, len, flags); Please refer to backing_file_splice_read() called from ovl_splice_read(), file_accessed() needs to be called on the original file (just as what .read_iter() i.e. filemap_read() does), and the input @ppos needs to be updated accordingly. -- Thanks, Jingbo