])
])
+dnl #
+dnl # 2.6.18 API change,
+dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
+dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
+dnl # if the mutex validator is disabled or otherwise unavailable.
+dnl #
+AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
+ AC_MSG_CHECKING([whether mutex_lock_nested() is available])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/mutex.h>
+ ],[
+ struct mutex mutex;
+ mutex_init(&mutex);
+ mutex_lock_nested(&mutex, 0);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
+ [mutex_lock_nested() is available])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
+
dnl #
dnl # 2.6.22 API change,
dnl # First introduced 'div64_64()' in lib/div64.c
+ echo "$as_me:$LINENO: checking whether mutex_lock_nested() is available" >&5
+echo $ECHO_N "checking whether mutex_lock_nested() is available... $ECHO_C" >&6
+
+
+cat >conftest.c <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+ #include <linux/mutex.h>
+
+int
+main (void)
+{
+
+ struct mutex mutex;
+ mutex_init(&mutex);
+ mutex_lock_nested(&mutex, 0);
+
+ ;
+ return 0;
+}
+
+_ACEOF
+
+
+ rm -Rf build && mkdir -p build
+ echo "obj-m := conftest.o" >build/Makefile
+ if { ac_try='cp conftest.c build && make modules LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MUTEX_LOCK_NESTED 1
+_ACEOF
+
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+
+
+fi
+
+ rm -Rf build
+
+
+
+
echo "$as_me:$LINENO: checking whether symbol div64_64 is exported" >&5
echo $ECHO_N "checking whether symbol div64_64 is exported... $ECHO_C" >&6
grep -q -E '[[:space:]]div64_64[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
SPL_AC_KMALLOC_NODE
SPL_AC_MONOTONIC_CLOCK
SPL_AC_INODE_I_MUTEX
+SPL_AC_MUTEX_LOCK_NESTED
SPL_AC_DIV64_64
SPL_AC_DIV64_U64
SPL_AC_3ARGS_ON_EACH_CPU
--- /dev/null
+#ifndef _SPL_MUTEX_COMPAT_H
+#define _SPL_MUTEX_COMPAT_H
+
+#include <linux/mutex.h>
+
+/* mutex_lock_nested() introduced in 2.6.18 */
+#ifndef HAVE_MUTEX_LOCK_NESTED
+# define mutex_lock_nested(lock, subclass) mutex_lock(lock)
+#endif /* HAVE_MUTEX_LOCK_NESTED */
+
+#endif /* _SPL_MUTEX_COMPAT_H */
+
#include <linux/smp_compat.h>
#include <linux/workqueue_compat.h>
#include <linux/kallsyms_compat.h>
+#include <linux/mutex_compat.h>
#ifndef HAVE_UINTPTR_T
typedef unsigned long uintptr_t;
/* monotonic_clock() is available */
#undef HAVE_MONOTONIC_CLOCK
+/* mutex_lock_nested() is available */
+#undef HAVE_MUTEX_LOCK_NESTED
+
/* next_online_pgdat() is available */
#undef HAVE_NEXT_ONLINE_PGDAT