From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@osdl.org, steved@redhat.com,
trond.myklebust@fys.uio.no, aviro@redhat.com
Cc: linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com,
nfsv4@linux-nfs.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/6] NFS: Add dentry materialisation op [try #6]
Date: Tue, 07 Mar 2006 11:33:59 +0000 [thread overview]
Message-ID: <20060307113359.23330.56446.stgit@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <20060307113352.23330.80913.stgit@warthog.cambridge.redhat.com>
The attached patch adds a new directory cache management function that prepares
a disconnected anonymous function to be connected into the dentry tree. The
anonymous dentry is transferred the name and parentage from another dentry.
The following changes were made in [try #2]:
(*) d_materialise_dentry() now switches the parentage of the two nodes around
correctly when one or other of them is self-referential.
Signed-Off-By: David Howells <dhowells@redhat.com>
---
fs/dcache.c | 25 +++++++++++++++++++++++++
include/linux/dcache.h | 1 +
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index a173bba..97e1e44 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1345,6 +1345,30 @@ already_unhashed:
}
/**
+ * d_materialise_dentry - connect a disconnected dentry into the tree
+ * @dentry: dentry to replace
+ * @anon: dentry to place into the tree
+ *
+ * Prepare an anonymous dentry for life in the superblock's dentry tree as a
+ * named dentry in place of the dentry to be replaced.
+ */
+void d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
+{
+ struct dentry *dparent, *aparent;
+
+ switch_names(dentry, anon);
+ do_switch(dentry->d_name.len, anon->d_name.len);
+ do_switch(dentry->d_name.hash, anon->d_name.hash);
+
+ dparent = dentry->d_parent;
+ aparent = anon->d_parent;
+ dentry->d_parent = (aparent == anon) ? dentry : aparent;
+ anon->d_parent = (dparent == dentry) ? anon : dparent;
+
+ anon->d_flags &= ~DCACHE_DISCONNECTED;
+}
+
+/**
* d_path - return the path of a dentry
* @dentry: dentry to report
* @vfsmnt: vfsmnt to which the dentry belongs
@@ -1755,6 +1779,7 @@ EXPORT_SYMBOL(d_instantiate);
EXPORT_SYMBOL(d_invalidate);
EXPORT_SYMBOL(d_lookup);
EXPORT_SYMBOL(d_move);
+EXPORT_SYMBOL_GPL(d_materialise_dentry);
EXPORT_SYMBOL(d_path);
EXPORT_SYMBOL(d_prune_aliases);
EXPORT_SYMBOL(d_rehash);
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 4361f37..feb9d4b 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -208,6 +208,7 @@ static inline int dname_external(struct
extern void d_instantiate(struct dentry *, struct inode *);
extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
extern void d_delete(struct dentry *);
+extern void d_materialise_dentry(struct dentry *, struct dentry *);
/* allocate/de-allocate */
extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
next prev parent reply other threads:[~2006-03-07 11:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-07 11:33 [PATCH 1/6] NFS: Permit filesystem to override root dentry on mount [try #6] David Howells
2006-03-07 11:33 ` [PATCH 2/6] 9p: Fix error handling on superblock alloc failure " David Howells
2006-03-07 11:33 ` [PATCH 3/6] NFS: Abstract out namespace initialisation " David Howells
2006-03-07 11:52 ` Christoph Hellwig
2006-03-07 11:33 ` David Howells [this message]
2006-03-07 11:34 ` [PATCH 5/6] NFS: Unify NFS superblocks per-protocol per-server " David Howells
2006-03-07 11:34 ` [PATCH 6/6] Optimise d_find_alias() " David Howells
2006-03-07 12:03 ` Nick Piggin
2006-03-07 13:24 ` David Howells
2006-03-08 8:22 ` Nick Piggin
2006-03-08 12:14 ` Matthew Wilcox
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=20060307113359.23330.56446.stgit@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=aviro@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nfsv4@linux-nfs.org \
--cc=steved@redhat.com \
--cc=torvalds@osdl.org \
--cc=trond.myklebust@fys.uio.no \
/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;
as well as URLs for NNTP newsgroup(s).