]> git.proxmox.com Git - mirror_spl-debian.git/commitdiff
Proxmox VE kernel compat, invalidate_inodes()
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 21 Dec 2011 22:22:45 +0000 (14:22 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 21 Dec 2011 22:29:45 +0000 (14:29 -0800)
The Proxmox VE kernel contains a patch which renames the function
invalidate_inodes() to invalidate_inodes_check().  In the process
it adds a 'check' argument and a '#define invalidate_inodes(x)'
compatibility wrapper for legacy callers.  Therefore, if either
of these functions are exported invalidate_inodes() can be
safely used.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #58

config/spl-build.m4
configure
include/linux/mm_compat.h
module/spl/spl-kmem.c
spl_config.h.in

index 7b6653559e89a66d6f179f4a4df0f3b8716efc19..90ff680840fb6b248b13335f5b30d25424083984 100644 (file)
@@ -1816,6 +1816,13 @@ dnl # The function invalidate_inodes() is no longer exported by the kernel.
 dnl # The prototype however is still available which means it is safe
 dnl # to acquire the symbol's address using spl_kallsyms_lookup_name().
 dnl #
+dnl # The Proxmox VE kernel contains a patch which renames the function
+dnl # invalidate_inodes() to invalidate_inodes_check().  In the process
+dnl # it adds a 'check' argument and a '#define invalidate_inodes(x)'
+dnl # compatibility wrapper for legacy callers.  Therefore, if either
+dnl # of these functions are exported invalidate_inodes() can be
+dnl # safely used.
+dnl #
 AC_DEFUN([SPL_AC_KERNEL_INVALIDATE_INODES], [
        SPL_CHECK_SYMBOL_EXPORT(
                [invalidate_inodes],
@@ -1823,6 +1830,12 @@ AC_DEFUN([SPL_AC_KERNEL_INVALIDATE_INODES], [
                [AC_DEFINE(HAVE_INVALIDATE_INODES, 1,
                [invalidate_inodes() is available])],
                [])
+       SPL_CHECK_SYMBOL_EXPORT(
+               [invalidate_inodes_check],
+               [],
+               [AC_DEFINE(HAVE_INVALIDATE_INODES_CHECK, 1,
+               [invalidate_inodes_check() is available])],
+               [])
 ])
 
 dnl #
index fc27ad1838389120c7056cabd08797e50dceb601..9d95d7654f69ae23d340aa24942051c4d203e401 100755 (executable)
--- a/configure
+++ b/configure
@@ -15638,6 +15638,45 @@ _ACEOF
 
        fi
 
+       { $as_echo "$as_me:$LINENO: checking whether symbol invalidate_inodes_check is exported" >&5
+$as_echo_n "checking whether symbol invalidate_inodes_check is exported... " >&6; }
+       grep -q -E '[[:space:]]invalidate_inodes_check[[:space:]]' \
+               $LINUX_OBJ/Module*.symvers 2>/dev/null
+       rc=$?
+       if test $rc -ne 0; then
+               export=0
+               for file in ; do
+                       grep -q -E "EXPORT_SYMBOL.*(invalidate_inodes_check)" \
+                               "$LINUX_OBJ/$file" 2>/dev/null
+                       rc=$?
+                       if test $rc -eq 0; then
+                               export=1
+                               break;
+                       fi
+               done
+               if test $export -eq 0; then
+                       { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+               else
+                       { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INVALIDATE_INODES_CHECK 1
+_ACEOF
+
+               fi
+       else
+               { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INVALIDATE_INODES_CHECK 1
+_ACEOF
+
+       fi
+
 
        { $as_echo "$as_me:$LINENO: checking whether invalidate_inodes() wants 2 args" >&5
 $as_echo_n "checking whether invalidate_inodes() wants 2 args... " >&6; }
@@ -19908,6 +19947,45 @@ _ACEOF
 
        fi
 
+       { $as_echo "$as_me:$LINENO: checking whether symbol invalidate_inodes_check is exported" >&5
+$as_echo_n "checking whether symbol invalidate_inodes_check is exported... " >&6; }
+       grep -q -E '[[:space:]]invalidate_inodes_check[[:space:]]' \
+               $LINUX_OBJ/Module*.symvers 2>/dev/null
+       rc=$?
+       if test $rc -ne 0; then
+               export=0
+               for file in ; do
+                       grep -q -E "EXPORT_SYMBOL.*(invalidate_inodes_check)" \
+                               "$LINUX_OBJ/$file" 2>/dev/null
+                       rc=$?
+                       if test $rc -eq 0; then
+                               export=1
+                               break;
+                       fi
+               done
+               if test $export -eq 0; then
+                       { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+               else
+                       { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INVALIDATE_INODES_CHECK 1
+_ACEOF
+
+               fi
+       else
+               { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INVALIDATE_INODES_CHECK 1
+_ACEOF
+
+       fi
+
 
        { $as_echo "$as_me:$LINENO: checking whether invalidate_inodes() wants 2 args" >&5
 $as_echo_n "checking whether invalidate_inodes() wants 2 args... " >&6; }
index b375f9b39be05a29073a5b91e779c11f6e0a4c8c..14fc3d7bb502fda4f948b0bb40215631e0b78ce0 100644 (file)
@@ -54,7 +54,7 @@
  * As for 2.6.39 invalidate_inodes() was updated to take a second
  * argument which controls how dirty inodes should be handled.
  */
-#ifdef HAVE_INVALIDATE_INODES
+#if defined(HAVE_INVALIDATE_INODES) || defined(HAVE_INVALIDATE_INODES_CHECK)
 # ifdef HAVE_2ARGS_INVALIDATE_INODES
 #  define spl_invalidate_inodes(sb, kd)        invalidate_inodes(sb, kd)
 # else
@@ -70,7 +70,7 @@ typedef int (*invalidate_inodes_t)(struct super_block *sb);
 extern invalidate_inodes_t invalidate_inodes_fn;
 #  define spl_invalidate_inodes(sb, kd)        invalidate_inodes_fn(sb)
 # endif /* HAVE_2ARGS_INVALIDATE_INODES */
-#endif /* HAVE_INVALIDATE_INODES */
+#endif /* HAVE_INVALIDATE_INODES || HAVE_INVALIDATE_INODES_CHECK */
 
 #if !defined(HAVE_SHRINK_CONTROL_STRUCT)
 struct shrink_control {
index 1d2fa90539375c22836852ad7bb9d8363c14ebfe..5a6011ad61a195e5b5af9e8fa7950f88c56403bf 100644 (file)
@@ -180,10 +180,10 @@ spl_global_page_state(spl_zone_stat_item_t item)
 #endif /* NEED_GET_ZONE_COUNTS */
 EXPORT_SYMBOL(spl_global_page_state);
 
-#ifndef HAVE_INVALIDATE_INODES
+#if !defined(HAVE_INVALIDATE_INODES) && !defined(HAVE_INVALIDATE_INODES_CHECK)
 invalidate_inodes_t invalidate_inodes_fn = SYMBOL_POISON;
 EXPORT_SYMBOL(invalidate_inodes_fn);
-#endif /* HAVE_INVALIDATE_INODES */
+#endif /* !HAVE_INVALIDATE_INODES && !HAVE_INVALIDATE_INODES_CHECK */
 
 #ifndef HAVE_SHRINK_DCACHE_MEMORY
 shrink_dcache_memory_t shrink_dcache_memory_fn = SYMBOL_POISON;
@@ -2113,14 +2113,14 @@ spl_kmem_init_kallsyms_lookup(void)
         */
        spl_kmem_init_globals();
 
-#ifndef HAVE_INVALIDATE_INODES
+#if !defined(HAVE_INVALIDATE_INODES) && !defined(HAVE_INVALIDATE_INODES_CHECK)
        invalidate_inodes_fn = (invalidate_inodes_t)
                spl_kallsyms_lookup_name("invalidate_inodes");
        if (!invalidate_inodes_fn) {
                printk(KERN_ERR "Error: Unknown symbol invalidate_inodes\n");
                return -EFAULT;
        }
-#endif /* HAVE_INVALIDATE_INODES */
+#endif /* !HAVE_INVALIDATE_INODES && !HAVE_INVALIDATE_INODES_CHECK */
 
 #ifndef HAVE_SHRINK_DCACHE_MEMORY
        /* When shrink_dcache_memory_fn == NULL support is disabled */
index 08b43426d2f3ab67e7fef3e70ed2c2a74c51f3a5..94e28e70d30dc2ac5fda759f82563b817b990833 100644 (file)
 /* invalidate_inodes() is available */
 #undef HAVE_INVALIDATE_INODES
 
+/* invalidate_inodes_check() is available */
+#undef HAVE_INVALIDATE_INODES_CHECK
+
 /* kallsyms_lookup_name() is available */
 #undef HAVE_KALLSYMS_LOOKUP_NAME