Whamcloud - gitweb
support for sles10 kernel in lustre.
authorshadow <shadow>
Tue, 6 Nov 2007 19:06:10 +0000 (19:06 +0000)
committershadow <shadow>
Tue, 6 Nov 2007 19:06:10 +0000 (19:06 +0000)
b=12052
i=johann
i=nikita

lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_acl.h
lustre/include/linux/lustre_compat25.h
lustre/include/lu_object.h
lustre/include/lustre_mdc.h
lustre/llite/dir.c
lustre/mdc/mdc_internal.h
lustre/obdclass/lu_time.c
lustre/ptlrpc/layout.c

index 1074d50..34f43f6 100644 (file)
@@ -1176,6 +1176,99 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+AC_DEFUN([LC_S_TIME_GRAN],
+[AC_MSG_CHECKING([if super block has s_time_gran member])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+],[
+       struct super_block sb;
+
+        return sb.s_time_gran;
+],[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
+AC_DEFUN([LC_SB_TIME_GRAN],
+[AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+],[
+       return get_sb_time_gran(NULL);
+],[
+        AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
+
+# ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
+AC_DEFUN([LC_RW_TREE_LOCK],
+[AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+],[
+       struct address_space a;
+
+       write_lock(&a.tree_lock);
+],[
+        AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
+],[
+        AC_MSG_RESULT([no])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+])
+
+AC_DEFUN([LC_CONST_ACL_SIZE],
+[AC_MSG_CHECKING([calc acl size])
+tmp_flags="$CFLAGS"
+CFLAGS="$CFLAGS -I $LINUX/include $EXTRA_KCFLAGS"
+AC_TRY_RUN([
+#include <linux/autoconf.h>
+#include <linux/types.h>
+// block include 
+#define __LINUX_POSIX_ACL_H
+
+# ifdef CONFIG_FS_POSIX_ACL
+#  ifdef HAVE_XATTR_ACL
+#   include <linux/xattr_acl.h>
+#  endif
+#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
+#   include <linux/posix_acl_xattr.h>
+#  endif
+# endif
+
+#include <linux/lustre_acl.h>
+
+#include <stdio.h>
+
+main(void)
+{
+    int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
+    FILE *f = fopen("acl.size","w+");
+    fprintf(f,"%d", size);
+    fclose(f);
+}
+
+],[
+       acl_size=`cat acl.size`
+       AC_MSG_RESULT([ACL size $acl_size])
+        AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
+],[
+        AC_ERROR([ACL size can't computed])
+])
+CFLAGS="$tmp_flags"
+])
+
+
 #
 # LC_PROG_LINUX
 #
@@ -1193,6 +1286,7 @@ LC_CONFIG_QUOTA
 LC_CONFIG_HEALTH_CHECK_WRITE
 LC_CONFIG_LRU_RESIZE
 
+
 LC_TASK_PPTR
 # RHEL4 patches
 LC_EXPORT_TRUNCATE_COMPLETE
@@ -1217,9 +1311,13 @@ LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
 LC_FILEMAP_POPULATE
 LC_D_ADD_UNIQUE
 LC_BIT_SPINLOCK_H
+
 LC_XATTR_ACL
-LC_STRUCT_INTENT_FILE
 LC_POSIX_ACL_XATTR_H
+LC_CONST_ACL_SIZE
+
+LC_STRUCT_INTENT_FILE
+
 LC_FUNC_SET_FS_PWD
 LC_CAPA_CRYPTO
 LC_CONFIG_GSS
@@ -1233,6 +1331,13 @@ LC_FUNC_RCU
 # does the kernel have VFS intent patches?
 LC_VFS_INTENT_PATCHES
 
+# ~2.6.11
+LC_S_TIME_GRAN
+LC_SB_TIME_GRAN
+
+# 2.6.12
+LC_RW_TREE_LOCK
+
 # 2.6.15
 LC_INODE_I_MUTEX
 
index bfa393e..bbf6471 100644 (file)
 # include <linux/fs.h>
 # include <linux/dcache.h>
 # ifdef CONFIG_FS_POSIX_ACL
-# include <linux/xattr_acl.h>
+#  ifdef HAVE_XATTR_ACL
+#   include <linux/xattr_acl.h>
+#  endif
+#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
+#   include <linux/posix_acl_xattr.h>
+#  endif
+# endif
+# ifndef HAVE_VFS_INTENT_PATCHES
+#  include <linux/lustre_intent.h>
 # endif
 #endif
 
 
 # define LUSTRE_POSIX_ACL_MAX_ENTRIES   (32)
 
-# ifdef __KERNEL__
-# define LUSTRE_POSIX_ACL_MAX_SIZE              \
-                (sizeof(xattr_acl_header) +     \
-                LUSTRE_POSIX_ACL_MAX_ENTRIES *  \
-                sizeof(xattr_acl_entry))
-# else /* __KERNEL__ */
-#  define LUSTRE_POSIX_ACL_MAX_SIZE      0
-# endif /* __KERNEL__ */
+# define LUSTRE_POSIX_ACL_MAX_SIZE   XATTR_ACL_SIZE
 
 #else /* CONFIG_FS_POSIX_ACL */
 # define LUSTRE_POSIX_ACL_MAX_SIZE      0
index e294e3f..b72ea7f 100644 (file)
@@ -336,5 +336,23 @@ generic_file_write(struct file *filp, const char __user *buf, size_t len, loff_t
 #define p_pptr parent
 #endif
 
+#ifndef HAVE_SB_TIME_GRAN
+#ifndef HAVE_S_TIME_GRAN
+#error Need s_time_gran patch!
+#endif
+static inline u32 get_sb_time_gran(struct super_block *sb)
+{
+        return sb->s_time_gran;
+}
+#endif
+
+#ifdef HAVE_RW_TREE_LOCK
+#define TREE_READ_LOCK_IRQ(mapping)    read_lock_irq(&(mapping)->tree_lock)
+#define TREE_READ_UNLOCK_IRQ(mapping) read_unlock_irq(&(mapping)->tree_lock)
+#else
+#define TREE_READ_LOCK_IRQ(mapping) spin_lock_irq(&(mapping)->tree_lock)
+#define TREE_READ_UNLOCK_IRQ(mapping) spin_unlock_irq(&(mapping)->tree_lock)
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* _COMPAT25_H */
index 698caf1..9c070e6 100644 (file)
@@ -827,7 +827,7 @@ static inline int lu_object_assert_not_exists(const struct lu_object *o)
 /*
  * Attr of this object.
  */
-static inline const __u32 lu_object_attr(const struct lu_object *o)
+static inline __u32 lu_object_attr(const struct lu_object *o)
 {
         LASSERT(lu_object_exists(o) > 0);
         return o->lo_header->loh_attr;
index d2c30d3..7b43f4f 100644 (file)
 # include <linux/fs.h>
 # include <linux/dcache.h>
 # ifdef CONFIG_FS_POSIX_ACL
-# include <linux/xattr_acl.h>
+#  ifdef HAVE_XATTR_ACL
+#   include <linux/xattr_acl.h>
+#  endif
+#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
+#   include <linux/posix_acl_xattr.h>
+#  endif
 # endif
 #endif
 #include <lustre_handles.h>
index da23ebf..42c2da6 100644 (file)
@@ -219,14 +219,14 @@ static struct page *ll_dir_page_locate(struct inode *dir, unsigned long hash,
         struct page *page;
         int found;
 
-       spin_lock_irq(&mapping->tree_lock);
+        TREE_READ_LOCK_IRQ(mapping);
        found = radix_tree_gang_lookup(&mapping->page_tree,
                                        (void **)&page, offset, 1);
        if (found > 0) {
                 struct lu_dirpage *dp;
 
                page_cache_get(page);
-                spin_unlock_irq(&mapping->tree_lock);
+                TREE_READ_UNLOCK_IRQ(mapping);
                 /*
                  * In contrast to find_lock_page() we are sure that directory
                  * page cannot be truncated (while DLM lock is held) and,
@@ -255,7 +255,7 @@ static struct page *ll_dir_page_locate(struct inode *dir, unsigned long hash,
                 }
 
        } else {
-                spin_unlock_irq(&mapping->tree_lock);
+                TREE_READ_UNLOCK_IRQ(mapping);
                 page = NULL;
         }
         return page;
index f982152..65df5fc 100644 (file)
@@ -83,9 +83,6 @@ static inline int client_is_remote(struct obd_export *exp)
         }
 }
 
-/* Quota stuff */
-extern quota_interface_t *quota_interface;
-
 /* mdc/mdc_locks.c */
 int mdc_set_lock_data(struct obd_export *exp,
                       __u64 *lockh, void *data);
index 3883c77..5a11f00 100644 (file)
@@ -151,7 +151,6 @@ unsigned long long lu_time_stamp_get(void)
         * do_gettimeofday() goes backwards sometimes :(.  Usethe TSC
         */
        unsigned long long ret;
-       extern unsigned long cpu_khz;
 
        rdtscll(ret);
        do_div(ret, cpu_khz / 1000);
index d014180..e223d5f 100644 (file)
 #include <lustre_req_layout.h>
 #include <linux/lustre_acl.h>
 
-#if __KERNEL__
-#define __POSIX_ACL_MAX_SIZE \
-        (sizeof(xattr_acl_header) + 32 * sizeof(xattr_acl_entry))
-#else
-#define __POSIX_ACL_MAX_SIZE 0
-#endif
-
 /*
  * empty set of fields... for suitable definition of emptiness.
  */
@@ -540,8 +533,8 @@ EXPORT_SYMBOL(RMF_REC_SETATTR);
 const struct req_msg_field RMF_EADATA = DEFINE_MSGF("eadata", 0, -1, NULL);
 EXPORT_SYMBOL(RMF_EADATA);
 
-const struct req_msg_field RMF_ACL = DEFINE_MSGF("acl", 0,
-                                     __POSIX_ACL_MAX_SIZE, NULL);
+const struct req_msg_field RMF_ACL = 
+        DEFINE_MSGF("acl", 0, LUSTRE_POSIX_ACL_MAX_SIZE, NULL);
 EXPORT_SYMBOL(RMF_ACL);
 
 const struct req_msg_field RMF_LOGCOOKIES =