mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hongzhen Luo <hongzhen@linux.alibaba.com>
To: linux-erofs@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org, Hongzhen Luo <hongzhen@linux.alibaba.com>
Subject: [RFC PATCH v6 7/7] erofs: implement .fadvise for page cache share
Date: Sat,  1 Mar 2025 22:49:44 +0800	[thread overview]
Message-ID: <20250301145002.2420830-8-hongzhen@linux.alibaba.com> (raw)
In-Reply-To: <20250301145002.2420830-1-hongzhen@linux.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@linux.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


      parent reply	other threads:[~2025-03-01 14:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-01 14:49 [RFC PATCH v6 0/7] erofs: inode page cache share feature Hongzhen Luo
2025-03-01 14:49 ` [RFC PATCH v6 1/7] erofs: move `struct erofs_anon_fs_type` to super.c Hongzhen Luo
2025-03-22  0:54   ` Hongbo Li
2025-03-01 14:49 ` [RFC PATCH v6 2/7] erofs: support user-defined fingerprint name Hongzhen Luo
2025-03-01 14:49 ` [RFC PATCH v6 3/7] erofs: support domain-specific page cache share Hongzhen Luo
2025-03-01 14:49 ` [RFC PATCH v6 4/7] erofs: introduce the page cache share feature Hongzhen Luo
2025-03-01 14:49 ` [RFC PATCH v6 5/7] erofs: support unencoded inodes for page cache share Hongzhen Luo
2025-03-01 14:49 ` [RFC PATCH v6 6/7] erofs: support compressed " Hongzhen Luo
2025-03-01 14:49 ` Hongzhen Luo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250301145002.2420830-8-hongzhen@linux.alibaba.com \
    --to=hongzhen@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®