[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251021104815.70662-8-lihongbo22@huawei.com>
Date: Tue, 21 Oct 2025 10:48:15 +0000
From: Hongbo Li <lihongbo22@...wei.com>
To: <hsiangkao@...ux.alibaba.com>, <chao@...nel.org>, <brauner@...nel.org>,
<hongzhen@...ux.alibaba.com>
CC: <linux-erofs@...ts.ozlabs.org>, <linux-kernel@...r.kernel.org>,
<lihongbo22@...wei.com>
Subject: [PATCH RFC v7 7/7] 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>
[hongbo: forward port, minor cleanup]
Signed-off-by: Hongbo Li <lihongbo22@...wei.com>
---
fs/erofs/ishare.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/fs/erofs/ishare.c b/fs/erofs/ishare.c
index 73432b13bf75..b067f0e02d6c 100644
--- a/fs/erofs/ishare.c
+++ b/fs/erofs/ishare.c
@@ -228,6 +228,16 @@ static int erofs_ishare_mmap(struct file *file, struct vm_area_struct *vma)
return generic_file_readonly_mmap(file, vma);
}
+static int erofs_ishare_fadvice(struct file *file, loff_t offset,
+ loff_t len, int advice)
+{
+ struct file *realfile = file->private_data;
+
+ if (!realfile)
+ return -EINVAL;
+ return vfs_fadvise(realfile, offset, len, advice);
+}
+
const struct file_operations erofs_ishare_fops = {
.open = erofs_ishare_file_open,
.llseek = generic_file_llseek,
@@ -236,6 +246,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_fadvice,
};
void erofs_read_begin(struct erofs_read_ctx *rdctx)
--
2.22.0
Powered by blists - more mailing lists