[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250301145002.2420830-8-hongzhen@linux.alibaba.com>
Date: Sat, 1 Mar 2025 22:49:44 +0800
From: Hongzhen Luo <hongzhen@...ux.alibaba.com>
To: linux-erofs@...ts.ozlabs.org
Cc: linux-kernel@...r.kernel.org,
Hongzhen Luo <hongzhen@...ux.alibaba.com>
Subject: [RFC PATCH v6 7/7] 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@...ux.alibaba.com>
---
fs/erofs/ishare.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/erofs/ishare.c b/fs/erofs/ishare.c
index e68bb1a6cf4b..a7c2be5d6f25 100644
--- a/fs/erofs/ishare.c
+++ b/fs/erofs/ishare.c
@@ -230,6 +230,14 @@ static int erofs_ishare_mmap(struct file *file, struct vm_area_struct *vma)
return 0;
}
+static int erofs_ishare_fadvice(struct file *realfile, loff_t offset, loff_t len,
+ int advice)
+{
+ struct file *file = realfile->private_data;
+
+ return vfs_fadvise(file, offset, len, advice);
+}
+
const struct file_operations erofs_ishare_fops = {
.open = erofs_ishare_file_open,
.llseek = generic_file_llseek,
@@ -238,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.43.5
Powered by blists - more mailing lists