[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251231090118.541061-11-lihongbo22@huawei.com>
Date: Wed, 31 Dec 2025 09:01:18 +0000
From: Hongbo Li <lihongbo22@...wei.com>
To: <hsiangkao@...ux.alibaba.com>, <chao@...nel.org>, <brauner@...nel.org>
CC: <djwong@...nel.org>, <amir73il@...il.com>, <hch@....de>,
<lihongbo22@...wei.com>, <linux-fsdevel@...r.kernel.org>,
<linux-erofs@...ts.ozlabs.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH v12 10/10] erofs: implement .fadvise for page cache share
From: Hongzhen Luo <hongzhen@...ux.alibaba.com>
This patch implements the .fadvise interface for page cache share.
Similar to overlayfs, it drops those clean, unused pages through
vfs_fadvise().
Signed-off-by: Hongzhen Luo <hongzhen@...ux.alibaba.com>
Signed-off-by: Hongbo Li <lihongbo22@...wei.com>
Reviewed-by: Gao Xiang <hsiangkao@...ux.alibaba.com>
---
fs/erofs/ishare.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/erofs/ishare.c b/fs/erofs/ishare.c
index b91f0ce412c0..2b7660d7e9d4 100644
--- a/fs/erofs/ishare.c
+++ b/fs/erofs/ishare.c
@@ -152,6 +152,13 @@ static int erofs_ishare_mmap(struct file *file, struct vm_area_struct *vma)
return generic_file_readonly_mmap(file, vma);
}
+static int erofs_ishare_fadvise(struct file *file, loff_t offset,
+ loff_t len, int advice)
+{
+ return vfs_fadvise((struct file *)file->private_data,
+ offset, len, advice);
+}
+
const struct file_operations erofs_ishare_fops = {
.open = erofs_ishare_file_open,
.llseek = generic_file_llseek,
@@ -160,6 +167,7 @@ const struct file_operations erofs_ishare_fops = {
.release = erofs_ishare_file_release,
.get_unmapped_area = thp_get_unmapped_area,
.splice_read = filemap_splice_read,
+ .fadvise = erofs_ishare_fadvise,
};
struct inode *erofs_real_inode(struct inode *inode, bool *need_iput)
--
2.22.0
Powered by blists - more mailing lists