summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHongzhen Luo <hongzhen@linux.alibaba.com>2026-01-23 04:31:32 +0300
committerGao Xiang <hsiangkao@linux.alibaba.com>2026-01-23 15:02:09 +0300
commitd86d7817c042dd651d47b1873f4b6eaefbedd890 (patch)
tree1a78e17af31c11a410ccc879f3533084a941cecc
parent9364b55a4dbf1ae9a8cb077cb8b7d0c7401d00fc (diff)
downloadlinux-d86d7817c042dd651d47b1873f4b6eaefbedd890.tar.xz
erofs: implement .fadvise for page cache share
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@linux.alibaba.com> Signed-off-by: Hongbo Li <lihongbo22@huawei.com> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
-rw-r--r--fs/erofs/ishare.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/erofs/ishare.c b/fs/erofs/ishare.c
index ad53a57dbcbc..ce980320a8b9 100644
--- a/fs/erofs/ishare.c
+++ b/fs/erofs/ishare.c
@@ -151,6 +151,12 @@ 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(file->private_data, offset, len, advice);
+}
+
const struct file_operations erofs_ishare_fops = {
.open = erofs_ishare_file_open,
.llseek = generic_file_llseek,
@@ -159,6 +165,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)