public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Drokin <green@clusterfs.com>
To: linux-kernel@vger.kernel.org, braam@clusterfs.com
Subject: [1/9] Lustre VFS patches for 2.6
Date: Wed, 7 Jul 2004 15:47:32 +0300	[thread overview]
Message-ID: <20040707124732.GA25891@clusterfs.com> (raw)

Introduce lock-free versions of d_rehash and d_move.

 fs/dcache.c            |   22 ++++++++++++++++++----
 include/linux/dcache.h |    2 ++
 2 files changed, 20 insertions(+), 4 deletions(-)

Index: linus-2.6.7-bk5/fs/dcache.c
===================================================================
--- linus-2.6.7-bk5.orig/fs/dcache.c	2004-06-24 10:39:11.232154728 +0300
+++ linus-2.6.7-bk5/fs/dcache.c	2004-06-24 10:56:01.043640048 +0300
@@ -1115,16 +1115,23 @@
  * Adds a dentry to the hash according to its name.
  */
  
-void d_rehash(struct dentry * entry)
+void __d_rehash(struct dentry * entry)
 {
 	struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
 
-	spin_lock(&dcache_lock);
 	spin_lock(&entry->d_lock);
  	entry->d_flags &= ~DCACHE_UNHASHED;
 	spin_unlock(&entry->d_lock);
 	entry->d_bucket = list;
  	hlist_add_head_rcu(&entry->d_hash, list);
+}
+
+EXPORT_SYMBOL(__d_rehash);
+ 
+void d_rehash(struct dentry * entry)
+{
+	spin_lock(&dcache_lock);
+	__d_rehash(entry);
 	spin_unlock(&dcache_lock);
 }
 
@@ -1200,12 +1207,11 @@
  * dcache entries should not be moved in this way.
  */
 
-void d_move(struct dentry * dentry, struct dentry * target)
+void __d_move(struct dentry * dentry, struct dentry * target)
 {
 	if (!dentry->d_inode)
 		printk(KERN_WARNING "VFS: moving negative dcache entry\n");
 
-	spin_lock(&dcache_lock);
 	write_seqlock(&rename_lock);
 	/*
 	 * XXXX: do we really need to take target->d_lock?
@@ -1257,6 +1263,14 @@
 	spin_unlock(&target->d_lock);
 	spin_unlock(&dentry->d_lock);
 	write_sequnlock(&rename_lock);
+}
+
+EXPORT_SYMBOL(__d_move);
+
+void d_move(struct dentry *dentry, struct dentry *target)
+{
+	spin_lock(&dcache_lock);
+	__d_move(dentry, target);
 	spin_unlock(&dcache_lock);
 }
 
Index: linus-2.6.7-bk5/include/linux/dcache.h
===================================================================
--- linus-2.6.7-bk5.orig/include/linux/dcache.h	2004-06-24 10:39:29.534372368 +0300
+++ linus-2.6.7-bk5/include/linux/dcache.h	2004-06-24 10:53:10.319594048 +0300
@@ -227,6 +227,7 @@
  * This adds the entry to the hash queues.
  */
 extern void d_rehash(struct dentry *);
+extern void __d_rehash(struct dentry *);
 
 /**
  * d_add - add dentry to hash queues
@@ -245,6 +246,7 @@
 
 /* used for rename() and baskets */
 extern void d_move(struct dentry *, struct dentry *);
+extern void __d_move(struct dentry *, struct dentry *);
 
 /* appendix may either be NULL or be used for transname suffixes */
 extern struct dentry * d_lookup(struct dentry *, struct qstr *);

                 reply	other threads:[~2004-07-07 12:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20040707124732.GA25891@clusterfs.com \
    --to=green@clusterfs.com \
    --cc=braam@clusterfs.com \
    --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