Skip to content

Commit d86d781

Browse files
Hongzhen Luohsiangkao
authored andcommitted
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>
1 parent 9364b55 commit d86d781

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

fs/erofs/ishare.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ static int erofs_ishare_mmap(struct file *file, struct vm_area_struct *vma)
151151
return generic_file_readonly_mmap(file, vma);
152152
}
153153

154+
static int erofs_ishare_fadvise(struct file *file, loff_t offset,
155+
loff_t len, int advice)
156+
{
157+
return vfs_fadvise(file->private_data, offset, len, advice);
158+
}
159+
154160
const struct file_operations erofs_ishare_fops = {
155161
.open = erofs_ishare_file_open,
156162
.llseek = generic_file_llseek,
@@ -159,6 +165,7 @@ const struct file_operations erofs_ishare_fops = {
159165
.release = erofs_ishare_file_release,
160166
.get_unmapped_area = thp_get_unmapped_area,
161167
.splice_read = filemap_splice_read,
168+
.fadvise = erofs_ishare_fadvise,
162169
};
163170

164171
struct inode *erofs_real_inode(struct inode *inode, bool *need_iput)

0 commit comments

Comments
 (0)