Whamcloud - gitweb
Branch HEAD
authoryangsheng <yangsheng>
Sat, 23 Feb 2008 06:14:41 +0000 (06:14 +0000)
committeryangsheng <yangsheng>
Sat, 23 Feb 2008 06:14:41 +0000 (06:14 +0000)
b=14714
i=adilger
i=johann

Move to use d_rehash_cond & d_move_locked.

12 files changed:
lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/kernel_patches/patches/iopen-misc-2.6-fc3.patch
lustre/kernel_patches/patches/iopen-misc-2.6.12.patch
lustre/kernel_patches/patches/iopen-misc-2.6.18-vanilla.patch
lustre/kernel_patches/patches/vfs_races-2.6-fc3.patch
lustre/kernel_patches/patches/vfs_races-2.6.12.patch
lustre/kernel_patches/patches/vfs_races-2.6.18-vanilla.patch
lustre/kernel_patches/series/2.6-sles10.series
lustre/llite/dcache.c
lustre/llite/llite_internal.h
lustre/llite/namei.c

index 9f5ee0e..a415368 100644 (file)
@@ -1162,6 +1162,24 @@ AC_DEFINE(HAVE___D_REHASH, 1,
 ])
 ])
 
+AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
+[LB_CHECK_SYMBOL_EXPORT([d_move_locked],
+[fs/dcache.c],[
+AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
+            [d_move_locked is exported by the kernel])
+],[
+])
+])
+
+AC_DEFUN([LC_EXPORT___D_MOVE],
+[LB_CHECK_SYMBOL_EXPORT([__d_move],
+[fs/dcache.c],[
+AC_DEFINE(HAVE___D_MOVE, 1,
+            [__d_move is exported by the kernel])
+],[
+])
+])
+
 # The actual symbol exported varies among architectures, so we need
 # to check many symbols (but only in the current architecture.)  No
 # matter what symbol is exported, the kernel #defines node_to_cpumask
@@ -1389,6 +1407,8 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_EXPORT_TRUNCATE_COMPLETE
          LC_EXPORT_D_REHASH_COND
          LC_EXPORT___D_REHASH
+         LC_EXPORT_D_MOVE_LOCKED
+         LC_EXPORT___D_MOVE
          LC_EXPORT_NODE_TO_CPUMASK
 
          LC_STRUCT_KIOBUF
index 019d92d..1d832a5 100644 (file)
@@ -182,8 +182,14 @@ static inline int cleanup_group_info(void)
 
 #include <linux/proc_fs.h>
 
-#ifndef HAVE___D_REHASH
-#define __d_rehash(dentry, lock) d_rehash_cond(dentry, lock)
+#if !defined(HAVE_D_REHASH_COND) && defined(HAVE___D_REHASH)
+#define d_rehash_cond(dentry, lock) __d_rehash(dentry, lock)
+extern void __d_rehash(struct dentry *dentry, int lock);
+#endif
+
+#if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE)
+#define d_move_locked(dentry, target) __d_move(dentry, target)
+extern void __d_move(struct dentry *dentry, struct dentry *target);
 #endif
 
 #ifdef HAVE_CAN_SLEEP_ARG
index 5dbefed..5fc42b5 100644 (file)
@@ -34,7 +34,7 @@ Index: linux-2.6.11/fs/dcache.c
   */
  
 -void d_move(struct dentry * dentry, struct dentry * target)
-+void __d_move(struct dentry * dentry, struct dentry * target)
++void d_move_locked(struct dentry * dentry, struct dentry * target)
  {
        struct hlist_head *list;
  
@@ -51,12 +51,12 @@ Index: linux-2.6.11/fs/dcache.c
        write_sequnlock(&rename_lock);
 +}
 +
-+EXPORT_SYMBOL(__d_move);
++EXPORT_SYMBOL(d_move_locked);
 +
 +void d_move(struct dentry *dentry, struct dentry *target)
 +{
 +      spin_lock(&dcache_lock);
-+      __d_move(dentry, target);
++      d_move_locked(dentry, target);
        spin_unlock(&dcache_lock);
  }
  
@@ -68,7 +68,7 @@ Index: linux-2.6.11/include/linux/dcache.h
   * This adds the entry to the hash queues.
   */
  extern void d_rehash(struct dentry *);
-+extern void __d_rehash(struct dentry *, int lock);
++extern void d_rehash_cond(struct dentry *, int lock);
  
  /**
   * d_add - add dentry to hash queues
@@ -76,7 +76,7 @@ Index: linux-2.6.11/include/linux/dcache.h
  
  /* used for rename() and baskets */
  extern void d_move(struct dentry *, struct dentry *);
-+extern void __d_move(struct dentry *, struct dentry *);
++extern void d_move_locked(struct dentry *, struct dentry *);
  
  /* appendix may either be NULL or be used for transname suffixes */
  extern struct dentry * d_lookup(struct dentry *, struct qstr *);
index c5d3c54..4819ed5 100644 (file)
@@ -64,7 +64,7 @@ Index: linux-2.6.16.46-0.14/fs/dcache.c
   */
  
 -void d_move(struct dentry * dentry, struct dentry * target)
-+void __d_move(struct dentry * dentry, struct dentry * target)
++void d_move_locked(struct dentry * dentry, struct dentry * target)
  {
        struct hlist_head *list;
  
@@ -81,12 +81,12 @@ Index: linux-2.6.16.46-0.14/fs/dcache.c
        write_sequnlock(&rename_lock);
 +}
 +
-+EXPORT_SYMBOL(__d_move);
++EXPORT_SYMBOL(d_move_locked);
 +
 +void d_move(struct dentry *dentry, struct dentry *target)
 +{
 +      spin_lock(&dcache_lock);
-+      __d_move(dentry, target);
++      d_move_locked(dentry, target);
        spin_unlock(&dcache_lock);
  }
  
@@ -106,7 +106,7 @@ Index: linux-2.6.16.46-0.14/include/linux/dcache.h
  
  /* used for rename() and baskets */
  extern void d_move(struct dentry *, struct dentry *);
-+extern void __d_move(struct dentry *, struct dentry *);
++extern void d_move_locked(struct dentry *, struct dentry *);
  
  /* appendix may either be NULL or be used for transname suffixes */
  extern struct dentry * d_lookup(struct dentry *, struct qstr *);
index 89927c3..e2d0e8a 100644 (file)
@@ -34,7 +34,7 @@ Index: linux-2.6/fs/dcache.c
   */
  
 -void d_move(struct dentry * dentry, struct dentry * target)
-+void __d_move(struct dentry * dentry, struct dentry * target)
++void d_move_locked(struct dentry * dentry, struct dentry * target)
  {
        struct hlist_head *list;
  
@@ -51,12 +51,12 @@ Index: linux-2.6/fs/dcache.c
        write_sequnlock(&rename_lock);
 +}
 +
-+EXPORT_SYMBOL(__d_move);
++EXPORT_SYMBOL(d_move_locked);
 +
 +void d_move(struct dentry *dentry, struct dentry *target)
 +{
 +      spin_lock(&dcache_lock);
-+      __d_move(dentry, target);
++      d_move_locked(dentry, target);
        spin_unlock(&dcache_lock);
  }
  
@@ -76,7 +76,7 @@ Index: linux-2.6/include/linux/dcache.h
  
  /* used for rename() and baskets */
  extern void d_move(struct dentry *, struct dentry *);
-+extern void __d_move(struct dentry *, struct dentry *);
++extern void d_move_locked(struct dentry *, struct dentry *);
  
  /* appendix may either be NULL or be used for transname suffixes */
  extern struct dentry * d_lookup(struct dentry *, struct qstr *);
index a0b643f..e0db838 100644 (file)
@@ -2,21 +2,12 @@ Index: linux-2.6.11/fs/dcache.c
 ===================================================================
 --- linux-2.6.11.orig/fs/dcache.c      2005-04-13 22:44:37.698760922 -0400
 +++ linux-2.6.11/fs/dcache.c   2005-04-13 22:44:50.482498026 -0400
-@@ -1183,7 +1183,7 @@
-       spin_unlock(&dcache_lock);
- }
--static void __d_rehash(struct dentry * entry, struct hlist_head *list)
-+static void __d_rehash_internal(struct dentry * entry, struct hlist_head *list)
- {
-       entry->d_flags &= ~DCACHE_UNHASHED;
 @@ -1197,15 +1197,24 @@
   * Adds a dentry to the hash according to its name.
   */
   
 -void d_rehash(struct dentry * entry)
-+void __d_rehash(struct dentry * entry, int lock)
++void d_rehash_cond(struct dentry * entry, int lock)
  {
        struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
  
@@ -24,31 +15,21 @@ Index: linux-2.6.11/fs/dcache.c
 +      if (lock)
 +              spin_lock(&dcache_lock);
        spin_lock(&entry->d_lock);
--      __d_rehash(entry, list);
-+      __d_rehash_internal(entry, list);
+       __d_rehash(entry, list);
        spin_unlock(&entry->d_lock);
 -      spin_unlock(&dcache_lock);
 +      if (lock)
 +              spin_unlock(&dcache_lock);
 +}
 +
-+EXPORT_SYMBOL(__d_rehash);
++EXPORT_SYMBOL(d_rehash_cond);
 +
 +void d_rehash(struct dentry * entry)
 +{
-+      __d_rehash(entry, 1);
++      d_rehash_cond(entry, 1);
  }
  
  #define do_switch(x,y) do { \
-@@ -1308,7 +1317,7 @@
- already_unhashed:
-       list = d_hash(target->d_parent, target->d_name.hash);
--      __d_rehash(dentry, list);
-+      __d_rehash_internal(dentry, list);
-       /* Unhash the target: dput() will then get rid of it */
-       __d_drop(target);
 Index: linux-2.6.11/include/linux/dcache.h
 ===================================================================
 --- linux-2.6.11.orig/include/linux/dcache.h   2005-04-13 22:35:23.515178600 -0400
@@ -62,3 +43,11 @@ Index: linux-2.6.11/include/linux/dcache.h
  
  extern spinlock_t dcache_lock;
  
+@@ -254,6 +255,7 @@ extern int have_submounts(struct dentry 
+  * This adds the entry to the hash queues.
+  */
+ extern void d_rehash(struct dentry *);
++extern void d_rehash_cond(struct dentry *, int lock);
+ /**
+  * d_add - add dentry to hash queues
index 011d87d..8666125 100644 (file)
@@ -59,3 +59,11 @@ Index: linux-2.6.7-vanilla/include/linux/dcache.h
  
  extern spinlock_t dcache_lock;
  
+@@ -254,6 +255,7 @@ extern int have_submounts(struct dentry 
+  * This adds the entry to the hash queues.
+  */
+ extern void d_rehash(struct dentry *);
++extern void d_rehash_cond(struct dentry *, int lock);
+ /**
+  * d_add - add dentry to hash queues
index 5898ff7..2d3fc7f 100644 (file)
@@ -58,3 +58,11 @@ Index: linux-2.6/include/linux/dcache.h
  
  #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */
  
+@@ -254,6 +255,7 @@ extern int have_submounts(struct dentry 
+  * This adds the entry to the hash queues.
+  */
+ extern void d_rehash(struct dentry *);
++extern void d_rehash_cond(struct dentry *, int lock);
+ /**
+  * d_add - add dentry to hash queues
index 90c0d31..b708c0f 100644 (file)
@@ -1,5 +1,6 @@
 lustre_version.patch
 jbd-2.6.10-jcberr.patch
+iopen-misc-2.6.12.patch
 export_symbols-2.6.12.patch 
 dev_read_only-2.6-fc5.patch 
 export-2.6-fc5.patch 
index 3ef3a35..878fd8e 100644 (file)
@@ -479,7 +479,7 @@ revalidate_finish:
         lock_dentry(de);
         __d_drop(de);
         unlock_dentry(de);
-        __d_rehash(de, 0);
+        d_rehash_cond(de, 0);
         spin_unlock(&dcache_lock);
 
 out:
index e81d275..492a0eb 100644 (file)
@@ -697,7 +697,6 @@ int ll_tree_unlock(struct ll_lock_tree *tree);
 
 #define    ll_s2sbi(sb)        (s2lsi(sb)->lsi_llsbi)
 
-void __d_rehash(struct dentry * entry, int lock);
 static inline __u64 ll_ts2u64(struct timespec *time)
 {
         __u64 t = time->tv_sec;
index 17388df..5aba9ed 100644 (file)
@@ -281,7 +281,7 @@ static void ll_d_add(struct dentry *de, struct inode *inode)
                        de->d_name.len, de->d_name.name, de, de->d_hash.next);
                 LBUG();
         }
-        __d_rehash(de, 0);
+        d_rehash_cond(de, 0);
 }
 
 /* Search "inode"'s alias list for a dentry that has the same name and parent
@@ -332,7 +332,7 @@ struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
                 dentry->d_flags &= ~DCACHE_LUSTRE_INVALID;
 #endif
                 unlock_dentry(dentry);
-                __d_rehash(dentry, 0); /* avoid taking dcache_lock inside */
+                d_rehash_cond(dentry, 0); /* avoid taking dcache_lock inside */
                 spin_unlock(&dcache_lock);
                 iput(inode);
                 CDEBUG(D_DENTRY, "alias dentry %.*s (%p) parent %p inode %p "
@@ -707,7 +707,7 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode,
          * successful create. Hash it here. */
         spin_lock(&dcache_lock);
         if (d_unhashed(dentry))
-                __d_rehash(dentry, 0);
+                d_rehash_cond(dentry, 0);
         spin_unlock(&dcache_lock);
         RETURN(0);
 }