Proxmox VE kernel compat, invalidate_inodes()

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
This commit is contained in:
Brian Behlendorf 2011-12-21 14:22:45 -08:00
parent cd2817f8a6
commit 5f6c14b1ed
5 changed files with 100 additions and 6 deletions

View 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 # The prototype however is still available which means it is safe
dnl # to acquire the symbol's address using spl_kallsyms_lookup_name(). dnl # to acquire the symbol's address using spl_kallsyms_lookup_name().
dnl # 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], [ AC_DEFUN([SPL_AC_KERNEL_INVALIDATE_INODES], [
SPL_CHECK_SYMBOL_EXPORT( SPL_CHECK_SYMBOL_EXPORT(
[invalidate_inodes], [invalidate_inodes],
@ -1823,6 +1830,12 @@ AC_DEFUN([SPL_AC_KERNEL_INVALIDATE_INODES], [
[AC_DEFINE(HAVE_INVALIDATE_INODES, 1, [AC_DEFINE(HAVE_INVALIDATE_INODES, 1,
[invalidate_inodes() is available])], [invalidate_inodes() is available])],
[]) [])
SPL_CHECK_SYMBOL_EXPORT(
[invalidate_inodes_check],
[],
[AC_DEFINE(HAVE_INVALIDATE_INODES_CHECK, 1,
[invalidate_inodes_check() is available])],
[])
]) ])
dnl # dnl #

78
configure vendored
View File

@ -15638,6 +15638,45 @@ _ACEOF
fi 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 "$as_me:$LINENO: checking whether invalidate_inodes() wants 2 args" >&5
$as_echo_n "checking whether invalidate_inodes() wants 2 args... " >&6; } $as_echo_n "checking whether invalidate_inodes() wants 2 args... " >&6; }
@ -19908,6 +19947,45 @@ _ACEOF
fi 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 "$as_me:$LINENO: checking whether invalidate_inodes() wants 2 args" >&5
$as_echo_n "checking whether invalidate_inodes() wants 2 args... " >&6; } $as_echo_n "checking whether invalidate_inodes() wants 2 args... " >&6; }

View File

@ -54,7 +54,7 @@
* As for 2.6.39 invalidate_inodes() was updated to take a second * As for 2.6.39 invalidate_inodes() was updated to take a second
* argument which controls how dirty inodes should be handled. * 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 # ifdef HAVE_2ARGS_INVALIDATE_INODES
# define spl_invalidate_inodes(sb, kd) invalidate_inodes(sb, kd) # define spl_invalidate_inodes(sb, kd) invalidate_inodes(sb, kd)
# else # else
@ -70,7 +70,7 @@ typedef int (*invalidate_inodes_t)(struct super_block *sb);
extern invalidate_inodes_t invalidate_inodes_fn; extern invalidate_inodes_t invalidate_inodes_fn;
# define spl_invalidate_inodes(sb, kd) invalidate_inodes_fn(sb) # define spl_invalidate_inodes(sb, kd) invalidate_inodes_fn(sb)
# endif /* HAVE_2ARGS_INVALIDATE_INODES */ # endif /* HAVE_2ARGS_INVALIDATE_INODES */
#endif /* HAVE_INVALIDATE_INODES */ #endif /* HAVE_INVALIDATE_INODES || HAVE_INVALIDATE_INODES_CHECK */
#if !defined(HAVE_SHRINK_CONTROL_STRUCT) #if !defined(HAVE_SHRINK_CONTROL_STRUCT)
struct shrink_control { struct shrink_control {

View File

@ -180,10 +180,10 @@ spl_global_page_state(spl_zone_stat_item_t item)
#endif /* NEED_GET_ZONE_COUNTS */ #endif /* NEED_GET_ZONE_COUNTS */
EXPORT_SYMBOL(spl_global_page_state); 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; invalidate_inodes_t invalidate_inodes_fn = SYMBOL_POISON;
EXPORT_SYMBOL(invalidate_inodes_fn); EXPORT_SYMBOL(invalidate_inodes_fn);
#endif /* HAVE_INVALIDATE_INODES */ #endif /* !HAVE_INVALIDATE_INODES && !HAVE_INVALIDATE_INODES_CHECK */
#ifndef HAVE_SHRINK_DCACHE_MEMORY #ifndef HAVE_SHRINK_DCACHE_MEMORY
shrink_dcache_memory_t shrink_dcache_memory_fn = SYMBOL_POISON; shrink_dcache_memory_t shrink_dcache_memory_fn = SYMBOL_POISON;
@ -2113,14 +2113,14 @@ spl_kmem_init_kallsyms_lookup(void)
*/ */
spl_kmem_init_globals(); spl_kmem_init_globals();
#ifndef HAVE_INVALIDATE_INODES #if !defined(HAVE_INVALIDATE_INODES) && !defined(HAVE_INVALIDATE_INODES_CHECK)
invalidate_inodes_fn = (invalidate_inodes_t) invalidate_inodes_fn = (invalidate_inodes_t)
spl_kallsyms_lookup_name("invalidate_inodes"); spl_kallsyms_lookup_name("invalidate_inodes");
if (!invalidate_inodes_fn) { if (!invalidate_inodes_fn) {
printk(KERN_ERR "Error: Unknown symbol invalidate_inodes\n"); printk(KERN_ERR "Error: Unknown symbol invalidate_inodes\n");
return -EFAULT; return -EFAULT;
} }
#endif /* HAVE_INVALIDATE_INODES */ #endif /* !HAVE_INVALIDATE_INODES && !HAVE_INVALIDATE_INODES_CHECK */
#ifndef HAVE_SHRINK_DCACHE_MEMORY #ifndef HAVE_SHRINK_DCACHE_MEMORY
/* When shrink_dcache_memory_fn == NULL support is disabled */ /* When shrink_dcache_memory_fn == NULL support is disabled */

View File

@ -111,6 +111,9 @@
/* invalidate_inodes() is available */ /* invalidate_inodes() is available */
#undef HAVE_INVALIDATE_INODES #undef HAVE_INVALIDATE_INODES
/* invalidate_inodes_check() is available */
#undef HAVE_INVALIDATE_INODES_CHECK
/* kallsyms_lookup_name() is available */ /* kallsyms_lookup_name() is available */
#undef HAVE_KALLSYMS_LOOKUP_NAME #undef HAVE_KALLSYMS_LOOKUP_NAME