mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH RFC 2/3] fs: provide no_revalidate_d_ops for network file systems
Date: Thu, 22 Aug 2019 08:51:01 +0200	[thread overview]
Message-ID: <20190822065102.22024-3-ahmad@a3f.at> (raw)
In-Reply-To: <20190822065102.22024-1-ahmad@a3f.at>

Networked file systems may wish to forego dentry caching altogether, so
every lookup goes over the network and stale data is avoided.
Provide a no_revalidate_d_ops helper object that does this.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 fs/fs.c                | 9 +++++++++
 include/linux/dcache.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index c6cb49996ec5..dda19db91341 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1262,6 +1262,15 @@ static void d_invalidate(struct dentry *dentry)
 {
 }
 
+static int d_no_revalidate(struct dentry *dir, unsigned int flags)
+{
+	return 0;
+}
+
+const struct dentry_operations no_revalidate_d_ops = {
+	.d_revalidate = d_no_revalidate,
+};
+
 static inline int d_revalidate(struct dentry *dentry, unsigned int flags)
 {
 	if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE))
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 1581ddc701d3..a9619422013e 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -185,4 +185,6 @@ static inline struct inode *d_inode(const struct dentry *dentry)
 
 char *dpath(struct dentry *dentry, struct dentry *root);
 
+extern const struct dentry_operations no_revalidate_d_ops;
+
 #endif	/* __LINUX_DCACHE_H */
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-08-22  6:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22  6:50 [PATCH RFC 0/3] fs: tftp: don't use cached dentries Ahmad Fatoum
2019-08-22  6:51 ` [PATCH RFC 1/3] fs: tftp: remove duplicate header Ahmad Fatoum
2019-08-22  6:51 ` Ahmad Fatoum [this message]
2019-08-22  6:51 ` [PATCH RFC 3/3] fs: tftp: don't maintain tftp dentries in dcache Ahmad Fatoum
2019-08-23  7:38 ` [PATCH RFC 0/3] fs: tftp: don't use cached dentries Sascha Hauer

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=20190822065102.22024-3-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=barebox@lists.infradead.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