Commit bulk of remaining 2.6.9 and 2.6.26 compat changes.
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@155 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
parent
322640b7b5
commit
3d061e9d10
|
@ -310,7 +310,7 @@ AC_DEFUN([SPL_CHECK_HEADER],
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.x API change
|
dnl # 2.6.24 API change,
|
||||||
dnl # check if uintptr_t typedef is defined
|
dnl # check if uintptr_t typedef is defined
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
|
AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
|
||||||
|
@ -329,7 +329,7 @@ AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.19 API change
|
dnl # 2.6.19 API change,
|
||||||
dnl # panic_notifier_list use atomic_notifier operations
|
dnl # panic_notifier_list use atomic_notifier operations
|
||||||
dnl #
|
dnl #
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ AC_DEFUN([SPL_AC_ATOMIC_PANIC_NOTIFIER],
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.20 API change
|
dnl # 2.6.20 API change,
|
||||||
dnl # INIT_WORK use 2 args and not store data inside
|
dnl # INIT_WORK use 2 args and not store data inside
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
|
AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
|
||||||
|
@ -371,7 +371,7 @@ AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.21 api change.
|
dnl # 2.6.21 API change,
|
||||||
dnl # 'register_sysctl_table' use only one argument instead of two
|
dnl # 'register_sysctl_table' use only one argument instead of two
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
|
AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
|
||||||
|
@ -390,7 +390,7 @@ AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.x API change
|
dnl # 2.6.23 API change
|
||||||
dnl # Old set_shrinker API replaced with register_shrinker
|
dnl # Old set_shrinker API replaced with register_shrinker
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_SET_SHRINKER], [
|
AC_DEFUN([SPL_AC_SET_SHRINKER], [
|
||||||
|
@ -409,7 +409,7 @@ AC_DEFUN([SPL_AC_SET_SHRINKER], [
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.x API change
|
dnl # 2.6.25 API change,
|
||||||
dnl # struct path entry added to struct nameidata
|
dnl # struct path entry added to struct nameidata
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
|
AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
|
||||||
|
@ -440,7 +440,7 @@ AC_DEFUN([SPL_AC_TASK_CURR], [
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.x API change
|
dnl # 2.6.19 API change,
|
||||||
dnl # Use CTL_UNNUMBERED when binary sysctl is not required
|
dnl # Use CTL_UNNUMBERED when binary sysctl is not required
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
|
AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
|
||||||
|
@ -506,18 +506,6 @@ AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
|
||||||
[])
|
[])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
|
||||||
dnl # 2.6.26 API change, set_normalized_timespec() is exported.
|
|
||||||
dnl #
|
|
||||||
AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
|
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
|
||||||
[class_device_create],
|
|
||||||
[drivers/base/class.c],
|
|
||||||
[AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
|
|
||||||
[class_device_create() is available])],
|
|
||||||
[])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.26 API change, set_normalized_timespec() is exported.
|
dnl # 2.6.26 API change, set_normalized_timespec() is exported.
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -540,7 +528,7 @@ AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
|
||||||
#include <linux/time.h>
|
#include <linux/time.h>
|
||||||
],[
|
],[
|
||||||
void set_normalized_timespec(struct timespec *ts,
|
void set_normalized_timespec(struct timespec *ts,
|
||||||
time_t sec, long nsec) { }
|
time_t sec, long nsec);
|
||||||
],[
|
],[
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
],[
|
],[
|
||||||
|
@ -570,17 +558,110 @@ AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.26 API change
|
dnl # 2.6.19 API change,
|
||||||
dnl # Definition of struct fdtable relocated to linux/fdtable.h
|
dnl # check if init_utsname() is available in linux/utsname.h
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([SPL_AC_INIT_UTSNAME], [
|
||||||
|
AC_MSG_CHECKING([whether init_utsname() is available])
|
||||||
|
SPL_LINUX_TRY_COMPILE([
|
||||||
|
#include <linux/utsname.h>
|
||||||
|
],[
|
||||||
|
struct new_utsname *a = init_utsname();
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl #
|
||||||
|
dnl # 2.6.26 API change,
|
||||||
|
dnl # definition of struct fdtable relocated to linux/fdtable.h
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
|
AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
|
||||||
SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
|
SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.18 API change
|
dnl # 2.6.14 API change,
|
||||||
dnl # Added linux/uaccess.h
|
dnl # check whether 'files_fdtable()' exists
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([SPL_AC_FILES_FDTABLE], [
|
||||||
|
AC_MSG_CHECKING([whether files_fdtable() is available])
|
||||||
|
SPL_LINUX_TRY_COMPILE([
|
||||||
|
#include <linux/sched.h>
|
||||||
|
#include <linux/file.h>
|
||||||
|
#ifdef HAVE_FDTABLE_HEADER
|
||||||
|
#include <linux/fdtable.h>
|
||||||
|
#endif
|
||||||
|
],[
|
||||||
|
struct files_struct *files = current->files;
|
||||||
|
struct fdtable *fdt = files_fdtable(files);
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl #
|
||||||
|
dnl # 2.6.18 API change,
|
||||||
|
dnl # added linux/uaccess.h
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_UACCESS_HEADER], [
|
AC_DEFUN([SPL_AC_UACCESS_HEADER], [
|
||||||
SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
|
SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl #
|
||||||
|
dnl # 2.6.12 API change,
|
||||||
|
dnl # check whether 'kmalloc_node()' is available.
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([SPL_AC_KMALLOC_NODE], [
|
||||||
|
AC_MSG_CHECKING([whether kmalloc_node() is available])
|
||||||
|
SPL_LINUX_TRY_COMPILE([
|
||||||
|
#include <linux/slab.h>
|
||||||
|
],[
|
||||||
|
void *a = kmalloc_node(1, GFP_KERNEL, 0);
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl #
|
||||||
|
dnl # 2.6.9 API change,
|
||||||
|
dnl # check whether 'monotonic_clock()' is available it may
|
||||||
|
dnl # be available for some archs but not others.
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
|
||||||
|
SPL_CHECK_SYMBOL_EXPORT(
|
||||||
|
[monotonic_clock],
|
||||||
|
[],
|
||||||
|
[AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
|
||||||
|
[monotonic_clock() is available])],
|
||||||
|
[])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl #
|
||||||
|
dnl # 2.6.16 API change,
|
||||||
|
dnl # check whether 'struct inode' has i_mutex
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
|
||||||
|
AC_MSG_CHECKING([whether struct inode has i_mutex])
|
||||||
|
SPL_LINUX_TRY_COMPILE([
|
||||||
|
#include <linux/fs.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
|
],[
|
||||||
|
struct inode i;
|
||||||
|
mutex_init(&i.i_mutex);
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
|
@ -57,8 +57,13 @@ SPL_AC_CLASS_DEVICE_CREATE
|
||||||
SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
|
SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
|
||||||
SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
|
SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
|
||||||
SPL_AC_TIMESPEC_SUB
|
SPL_AC_TIMESPEC_SUB
|
||||||
|
SPL_AC_INIT_UTSNAME
|
||||||
SPL_AC_FDTABLE_HEADER
|
SPL_AC_FDTABLE_HEADER
|
||||||
|
SPL_AC_FILES_FDTABLE
|
||||||
SPL_AC_UACCESS_HEADER
|
SPL_AC_UACCESS_HEADER
|
||||||
|
SPL_AC_KMALLOC_NODE
|
||||||
|
SPL_AC_MONOTONIC_CLOCK
|
||||||
|
SPL_AC_INODE_I_MUTEX
|
||||||
|
|
||||||
TOPDIR=`/bin/pwd`
|
TOPDIR=`/bin/pwd`
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,13 @@ extern "C" {
|
||||||
#define KM_VMFLAGS GFP_LEVEL_MASK
|
#define KM_VMFLAGS GFP_LEVEL_MASK
|
||||||
#define KM_FLAGS __GFP_BITS_MASK
|
#define KM_FLAGS __GFP_BITS_MASK
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Used internally, the kernel does not need to support this flag
|
||||||
|
*/
|
||||||
|
#ifndef __GFP_ZERO
|
||||||
|
#define __GFP_ZERO 0x8000
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_KMEM
|
#ifdef DEBUG_KMEM
|
||||||
extern atomic64_t kmem_alloc_used;
|
extern atomic64_t kmem_alloc_used;
|
||||||
extern unsigned long kmem_alloc_max;
|
extern unsigned long kmem_alloc_max;
|
||||||
|
@ -113,7 +120,7 @@ __kmem_del_init(spinlock_t *lock,struct hlist_head *table,int bits,void *addr)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __kmem_alloc(size, flags, allocator) \
|
#define __kmem_alloc(size, flags, allocator, args...) \
|
||||||
({ void *_ptr_ = NULL; \
|
({ void *_ptr_ = NULL; \
|
||||||
kmem_debug_t *_dptr_; \
|
kmem_debug_t *_dptr_; \
|
||||||
unsigned long _flags_; \
|
unsigned long _flags_; \
|
||||||
|
@ -133,7 +140,7 @@ __kmem_del_init(spinlock_t *lock,struct hlist_head *table,int bits,void *addr)
|
||||||
atomic64_read(&kmem_alloc_used), \
|
atomic64_read(&kmem_alloc_used), \
|
||||||
kmem_alloc_max); \
|
kmem_alloc_max); \
|
||||||
\
|
\
|
||||||
_ptr_ = (void *)allocator((size), (flags)); \
|
_ptr_ = (void *)allocator((size), (flags), ## args); \
|
||||||
if (_ptr_ == NULL) { \
|
if (_ptr_ == NULL) { \
|
||||||
kfree(_dptr_); \
|
kfree(_dptr_); \
|
||||||
__CDEBUG_LIMIT(S_KMEM, D_WARNING, "Warning " \
|
__CDEBUG_LIMIT(S_KMEM, D_WARNING, "Warning " \
|
||||||
|
@ -273,7 +280,7 @@ __kmem_del_init(spinlock_t *lock,struct hlist_head *table,int bits,void *addr)
|
||||||
|
|
||||||
#else /* DEBUG_KMEM_TRACKING */
|
#else /* DEBUG_KMEM_TRACKING */
|
||||||
|
|
||||||
#define __kmem_alloc(size, flags, allocator) \
|
#define __kmem_alloc(size, flags, allocator, args...) \
|
||||||
({ void *_ptr_ = NULL; \
|
({ void *_ptr_ = NULL; \
|
||||||
\
|
\
|
||||||
/* Marked unlikely because we should never be doing this, */ \
|
/* Marked unlikely because we should never be doing this, */ \
|
||||||
|
@ -285,7 +292,7 @@ __kmem_del_init(spinlock_t *lock,struct hlist_head *table,int bits,void *addr)
|
||||||
atomic64_read(&kmem_alloc_used), \
|
atomic64_read(&kmem_alloc_used), \
|
||||||
kmem_alloc_max); \
|
kmem_alloc_max); \
|
||||||
\
|
\
|
||||||
_ptr_ = (void *)allocator((size), (flags)); \
|
_ptr_ = (void *)allocator((size), (flags), ## args); \
|
||||||
if (_ptr_ == NULL) { \
|
if (_ptr_ == NULL) { \
|
||||||
__CDEBUG_LIMIT(S_KMEM, D_WARNING, "Warning " \
|
__CDEBUG_LIMIT(S_KMEM, D_WARNING, "Warning " \
|
||||||
"kmem_alloc(%d, 0x%x) failed (%ld/" \
|
"kmem_alloc(%d, 0x%x) failed (%ld/" \
|
||||||
|
@ -370,6 +377,14 @@ __kmem_del_init(spinlock_t *lock,struct hlist_head *table,int bits,void *addr)
|
||||||
#define kmem_alloc(size, flags) __kmem_alloc((size), (flags), kmalloc)
|
#define kmem_alloc(size, flags) __kmem_alloc((size), (flags), kmalloc)
|
||||||
#define kmem_zalloc(size, flags) __kmem_alloc((size), (flags), kzalloc)
|
#define kmem_zalloc(size, flags) __kmem_alloc((size), (flags), kzalloc)
|
||||||
|
|
||||||
|
#ifdef HAVE_KMALLOC_NODE
|
||||||
|
#define kmem_alloc_node(size, flags, node) \
|
||||||
|
__kmem_alloc((size), (flags), kmalloc_node, node)
|
||||||
|
#else
|
||||||
|
#define kmem_alloc_node(size, flags, node) \
|
||||||
|
__kmem_alloc((size), (flags), kmalloc)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define vmem_alloc(size, flags) __vmem_alloc((size), (flags))
|
#define vmem_alloc(size, flags) __vmem_alloc((size), (flags))
|
||||||
#define vmem_zalloc(size, flags) __vmem_alloc((size), ((flags) | __GFP_ZERO))
|
#define vmem_zalloc(size, flags) __vmem_alloc((size), ((flags) | __GFP_ZERO))
|
||||||
|
|
||||||
|
@ -379,6 +394,14 @@ __kmem_del_init(spinlock_t *lock,struct hlist_head *table,int bits,void *addr)
|
||||||
#define kmem_zalloc(size, flags) kzalloc((size), (flags))
|
#define kmem_zalloc(size, flags) kzalloc((size), (flags))
|
||||||
#define kmem_free(ptr, size) kfree(ptr)
|
#define kmem_free(ptr, size) kfree(ptr)
|
||||||
|
|
||||||
|
#ifdef HAVE_KMALLOC_NODE
|
||||||
|
#define kmem_alloc_node(size, flags, node) \
|
||||||
|
kmalloc_node((size), (flags), (node))
|
||||||
|
#else
|
||||||
|
#define kmem_alloc_node(size, flags, node) \
|
||||||
|
kmalloc((size), (flags))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define vmem_alloc(size, flags) __vmalloc((size), ((flags) | \
|
#define vmem_alloc(size, flags) __vmalloc((size), ((flags) | \
|
||||||
__GFP_HIGHMEM), PAGE_KERNEL)
|
__GFP_HIGHMEM), PAGE_KERNEL)
|
||||||
#define vmem_zalloc(size, flags) \
|
#define vmem_zalloc(size, flags) \
|
||||||
|
@ -555,14 +578,6 @@ void spl_kmem_fini(void);
|
||||||
#define kmem_virt(ptr) (((ptr) >= (void *)VMALLOC_START) && \
|
#define kmem_virt(ptr) (((ptr) >= (void *)VMALLOC_START) && \
|
||||||
((ptr) < (void *)VMALLOC_END))
|
((ptr) < (void *)VMALLOC_END))
|
||||||
|
|
||||||
#ifdef HAVE_KMEM_CACHE_CREATE_DTOR
|
|
||||||
#define __kmem_cache_create(name, size, align, flags, ctor, dtor) \
|
|
||||||
kmem_cache_create(name, size, align, flags, ctor, dtor)
|
|
||||||
#else
|
|
||||||
#define __kmem_cache_create(name, size, align, flags, ctor, dtor) \
|
|
||||||
kmem_cache_create(name, size, align, flags, ctor)
|
|
||||||
#endif /* HAVE_KMEM_CACHE_CREATE_DTOR */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,7 +37,6 @@ extern "C" {
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/kmem.h>
|
|
||||||
|
|
||||||
#define TASKQ_NAMELEN 31
|
#define TASKQ_NAMELEN 31
|
||||||
|
|
||||||
|
@ -60,14 +59,6 @@ typedef void (task_func_t)(void *);
|
||||||
#define TQ_NEW 0x04000000
|
#define TQ_NEW 0x04000000
|
||||||
#define TQ_ACTIVE 0x80000000
|
#define TQ_ACTIVE 0x80000000
|
||||||
|
|
||||||
typedef struct task {
|
|
||||||
spinlock_t t_lock;
|
|
||||||
struct list_head t_list;
|
|
||||||
taskqid_t t_id;
|
|
||||||
task_func_t *t_func;
|
|
||||||
void *t_arg;
|
|
||||||
} task_t;
|
|
||||||
|
|
||||||
typedef struct taskq {
|
typedef struct taskq {
|
||||||
spinlock_t tq_lock; /* protects taskq_t */
|
spinlock_t tq_lock; /* protects taskq_t */
|
||||||
struct task_struct **tq_threads; /* thread pointers */
|
struct task_struct **tq_threads; /* thread pointers */
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
#include <linux/hardirq.h>
|
#include <linux/hardirq.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/notifier.h>
|
||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/debug.h>
|
#include <sys/debug.h>
|
||||||
|
@ -375,7 +376,7 @@ spl_debug_dumplog_thread(void *arg)
|
||||||
spl_debug_dumplog_internal(dp);
|
spl_debug_dumplog_internal(dp);
|
||||||
atomic_set(&dp->dp_done, 1);
|
atomic_set(&dp->dp_done, 1);
|
||||||
wake_up(&dp->dp_waitq);
|
wake_up(&dp->dp_waitq);
|
||||||
do_exit(0);
|
complete_and_exit(NULL, 0);
|
||||||
|
|
||||||
return 0; /* Unreachable */
|
return 0; /* Unreachable */
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,11 @@ EXPORT_SYMBOL(ddi_strtoul);
|
||||||
|
|
||||||
struct new_utsname *__utsname(void)
|
struct new_utsname *__utsname(void)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_INIT_UTSNAME
|
||||||
return init_utsname();
|
return init_utsname();
|
||||||
|
#else
|
||||||
|
return &system_utsname;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__utsname);
|
EXPORT_SYMBOL(__utsname);
|
||||||
|
|
||||||
|
|
|
@ -370,7 +370,7 @@ spl_magazine_alloc(spl_kmem_cache_t *skc, int node)
|
||||||
sizeof(void *) * skc->skc_mag_size;
|
sizeof(void *) * skc->skc_mag_size;
|
||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
skm = kmalloc_node(size, GFP_KERNEL, node);
|
skm = kmem_alloc_node(size, GFP_KERNEL, node);
|
||||||
if (skm) {
|
if (skm) {
|
||||||
skm->skm_magic = SKM_MAGIC;
|
skm->skm_magic = SKM_MAGIC;
|
||||||
skm->skm_avail = 0;
|
skm->skm_avail = 0;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/taskq.h>
|
#include <sys/taskq.h>
|
||||||
|
#include <sys/kmem.h>
|
||||||
|
|
||||||
#ifdef DEBUG_SUBSYSTEM
|
#ifdef DEBUG_SUBSYSTEM
|
||||||
#undef DEBUG_SUBSYSTEM
|
#undef DEBUG_SUBSYSTEM
|
||||||
|
@ -32,13 +33,21 @@
|
||||||
|
|
||||||
#define DEBUG_SUBSYSTEM S_TASKQ
|
#define DEBUG_SUBSYSTEM S_TASKQ
|
||||||
|
|
||||||
|
typedef struct spl_task {
|
||||||
|
spinlock_t t_lock;
|
||||||
|
struct list_head t_list;
|
||||||
|
taskqid_t t_id;
|
||||||
|
task_func_t *t_func;
|
||||||
|
void *t_arg;
|
||||||
|
} spl_task_t;
|
||||||
|
|
||||||
/* NOTE: Must be called with tq->tq_lock held, returns a list_t which
|
/* NOTE: Must be called with tq->tq_lock held, returns a list_t which
|
||||||
* is not attached to the free, work, or pending taskq lists.
|
* is not attached to the free, work, or pending taskq lists.
|
||||||
*/
|
*/
|
||||||
static task_t *
|
static spl_task_t *
|
||||||
task_alloc(taskq_t *tq, uint_t flags)
|
task_alloc(taskq_t *tq, uint_t flags)
|
||||||
{
|
{
|
||||||
task_t *t;
|
spl_task_t *t;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
|
@ -47,9 +56,9 @@ task_alloc(taskq_t *tq, uint_t flags)
|
||||||
ASSERT(!((flags & TQ_SLEEP) && (flags & TQ_NOSLEEP))); /* Not both */
|
ASSERT(!((flags & TQ_SLEEP) && (flags & TQ_NOSLEEP))); /* Not both */
|
||||||
ASSERT(spin_is_locked(&tq->tq_lock));
|
ASSERT(spin_is_locked(&tq->tq_lock));
|
||||||
retry:
|
retry:
|
||||||
/* Aquire task_t's from free list if available */
|
/* Aquire spl_task_t's from free list if available */
|
||||||
if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) {
|
if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) {
|
||||||
t = list_entry(tq->tq_free_list.next, task_t, t_list);
|
t = list_entry(tq->tq_free_list.next, spl_task_t, t_list);
|
||||||
list_del_init(&t->t_list);
|
list_del_init(&t->t_list);
|
||||||
RETURN(t);
|
RETURN(t);
|
||||||
}
|
}
|
||||||
|
@ -58,13 +67,13 @@ retry:
|
||||||
if (flags & TQ_NOALLOC)
|
if (flags & TQ_NOALLOC)
|
||||||
RETURN(NULL);
|
RETURN(NULL);
|
||||||
|
|
||||||
/* Hit maximum task_t pool size */
|
/* Hit maximum spl_task_t pool size */
|
||||||
if (tq->tq_nalloc >= tq->tq_maxalloc) {
|
if (tq->tq_nalloc >= tq->tq_maxalloc) {
|
||||||
if (flags & TQ_NOSLEEP)
|
if (flags & TQ_NOSLEEP)
|
||||||
RETURN(NULL);
|
RETURN(NULL);
|
||||||
|
|
||||||
/* Sleep periodically polling the free list for an available
|
/* Sleep periodically polling the free list for an available
|
||||||
* task_t. If a full second passes and we have not found
|
* spl_task_t. If a full second passes and we have not found
|
||||||
* one gives up and return a NULL to the caller. */
|
* one gives up and return a NULL to the caller. */
|
||||||
if (flags & TQ_SLEEP) {
|
if (flags & TQ_SLEEP) {
|
||||||
spin_unlock_irq(&tq->tq_lock);
|
spin_unlock_irq(&tq->tq_lock);
|
||||||
|
@ -81,7 +90,7 @@ retry:
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irq(&tq->tq_lock);
|
spin_unlock_irq(&tq->tq_lock);
|
||||||
t = kmem_alloc(sizeof(task_t), flags & (TQ_SLEEP | TQ_NOSLEEP));
|
t = kmem_alloc(sizeof(spl_task_t), flags & (TQ_SLEEP | TQ_NOSLEEP));
|
||||||
spin_lock_irq(&tq->tq_lock);
|
spin_lock_irq(&tq->tq_lock);
|
||||||
|
|
||||||
if (t) {
|
if (t) {
|
||||||
|
@ -96,11 +105,11 @@ retry:
|
||||||
RETURN(t);
|
RETURN(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE: Must be called with tq->tq_lock held, expectes the task_t
|
/* NOTE: Must be called with tq->tq_lock held, expectes the spl_task_t
|
||||||
* to already be removed from the free, work, or pending taskq lists.
|
* to already be removed from the free, work, or pending taskq lists.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
task_free(taskq_t *tq, task_t *t)
|
task_free(taskq_t *tq, spl_task_t *t)
|
||||||
{
|
{
|
||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
|
@ -109,17 +118,17 @@ task_free(taskq_t *tq, task_t *t)
|
||||||
ASSERT(spin_is_locked(&tq->tq_lock));
|
ASSERT(spin_is_locked(&tq->tq_lock));
|
||||||
ASSERT(list_empty(&t->t_list));
|
ASSERT(list_empty(&t->t_list));
|
||||||
|
|
||||||
kmem_free(t, sizeof(task_t));
|
kmem_free(t, sizeof(spl_task_t));
|
||||||
tq->tq_nalloc--;
|
tq->tq_nalloc--;
|
||||||
|
|
||||||
EXIT;
|
EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE: Must be called with tq->tq_lock held, either destroyes the
|
/* NOTE: Must be called with tq->tq_lock held, either destroyes the
|
||||||
* task_t if too many exist or moves it to the free list for later use.
|
* spl_task_t if too many exist or moves it to the free list for later use.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
task_done(taskq_t *tq, task_t *t)
|
task_done(taskq_t *tq, spl_task_t *t)
|
||||||
{
|
{
|
||||||
ENTRY;
|
ENTRY;
|
||||||
ASSERT(tq);
|
ASSERT(tq);
|
||||||
|
@ -207,7 +216,7 @@ EXPORT_SYMBOL(__taskq_member);
|
||||||
taskqid_t
|
taskqid_t
|
||||||
__taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags)
|
__taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags)
|
||||||
{
|
{
|
||||||
task_t *t;
|
spl_task_t *t;
|
||||||
taskqid_t rc = 0;
|
taskqid_t rc = 0;
|
||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
|
@ -254,7 +263,7 @@ static taskqid_t
|
||||||
taskq_lowest_id(taskq_t *tq)
|
taskq_lowest_id(taskq_t *tq)
|
||||||
{
|
{
|
||||||
taskqid_t lowest_id = ~0;
|
taskqid_t lowest_id = ~0;
|
||||||
task_t *t;
|
spl_task_t *t;
|
||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
ASSERT(tq);
|
ASSERT(tq);
|
||||||
|
@ -278,7 +287,7 @@ taskq_thread(void *args)
|
||||||
sigset_t blocked;
|
sigset_t blocked;
|
||||||
taskqid_t id;
|
taskqid_t id;
|
||||||
taskq_t *tq = args;
|
taskq_t *tq = args;
|
||||||
task_t *t;
|
spl_task_t *t;
|
||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
ASSERT(tq);
|
ASSERT(tq);
|
||||||
|
@ -306,7 +315,7 @@ taskq_thread(void *args)
|
||||||
|
|
||||||
remove_wait_queue(&tq->tq_work_waitq, &wait);
|
remove_wait_queue(&tq->tq_work_waitq, &wait);
|
||||||
if (!list_empty(&tq->tq_pend_list)) {
|
if (!list_empty(&tq->tq_pend_list)) {
|
||||||
t = list_entry(tq->tq_pend_list.next, task_t, t_list);
|
t = list_entry(tq->tq_pend_list.next, spl_task_t, t_list);
|
||||||
list_del_init(&t->t_list);
|
list_del_init(&t->t_list);
|
||||||
list_add_tail(&t->t_list, &tq->tq_work_list);
|
list_add_tail(&t->t_list, &tq->tq_work_list);
|
||||||
tq->tq_nactive++;
|
tq->tq_nactive++;
|
||||||
|
@ -418,7 +427,7 @@ EXPORT_SYMBOL(__taskq_create);
|
||||||
void
|
void
|
||||||
__taskq_destroy(taskq_t *tq)
|
__taskq_destroy(taskq_t *tq)
|
||||||
{
|
{
|
||||||
task_t *t;
|
spl_task_t *t;
|
||||||
int i, nthreads;
|
int i, nthreads;
|
||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
|
@ -438,7 +447,7 @@ __taskq_destroy(taskq_t *tq)
|
||||||
spin_lock_irq(&tq->tq_lock);
|
spin_lock_irq(&tq->tq_lock);
|
||||||
|
|
||||||
while (!list_empty(&tq->tq_free_list)) {
|
while (!list_empty(&tq->tq_free_list)) {
|
||||||
t = list_entry(tq->tq_free_list.next, task_t, t_list);
|
t = list_entry(tq->tq_free_list.next, spl_task_t, t_list);
|
||||||
list_del_init(&t->t_list);
|
list_del_init(&t->t_list);
|
||||||
task_free(tq, t);
|
task_free(tq, t);
|
||||||
}
|
}
|
||||||
|
@ -450,7 +459,7 @@ __taskq_destroy(taskq_t *tq)
|
||||||
ASSERT(list_empty(&tq->tq_pend_list));
|
ASSERT(list_empty(&tq->tq_pend_list));
|
||||||
|
|
||||||
spin_unlock_irq(&tq->tq_lock);
|
spin_unlock_irq(&tq->tq_lock);
|
||||||
kmem_free(tq->tq_threads, nthreads * sizeof(task_t *));
|
kmem_free(tq->tq_threads, nthreads * sizeof(spl_task_t *));
|
||||||
kmem_free(tq, sizeof(taskq_t));
|
kmem_free(tq, sizeof(taskq_t));
|
||||||
|
|
||||||
EXIT;
|
EXIT;
|
||||||
|
|
|
@ -73,7 +73,7 @@ __thread_exit(void)
|
||||||
{
|
{
|
||||||
ENTRY;
|
ENTRY;
|
||||||
EXIT;
|
EXIT;
|
||||||
do_exit(0);
|
complete_and_exit(NULL, 0);
|
||||||
/* Unreachable */
|
/* Unreachable */
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__thread_exit);
|
EXPORT_SYMBOL(__thread_exit);
|
||||||
|
|
|
@ -27,6 +27,10 @@
|
||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_MONOTONIC_CLOCK
|
||||||
|
extern unsigned long long monotonic_clock(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_SUBSYSTEM
|
#ifdef DEBUG_SUBSYSTEM
|
||||||
#undef DEBUG_SUBSYSTEM
|
#undef DEBUG_SUBSYSTEM
|
||||||
#endif
|
#endif
|
||||||
|
@ -36,27 +40,26 @@
|
||||||
void
|
void
|
||||||
__gethrestime(timestruc_t *ts)
|
__gethrestime(timestruc_t *ts)
|
||||||
{
|
{
|
||||||
getnstimeofday((struct timespec *)ts);
|
struct timeval tv;
|
||||||
|
|
||||||
|
do_gettimeofday(&tv);
|
||||||
|
ts->tv_sec = tv.tv_sec;
|
||||||
|
ts->tv_nsec = tv.tv_usec * NSEC_PER_USEC;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__gethrestime);
|
EXPORT_SYMBOL(__gethrestime);
|
||||||
|
|
||||||
int
|
/* Use monotonic_clock() by default. It's faster and is available on older
|
||||||
__clock_gettime(clock_type_t type, timespec_t *tp)
|
* kernels, but few architectures have them, so we must fallback to
|
||||||
{
|
* do_posix_clock_monotonic_gettime().
|
||||||
/* Only support CLOCK_REALTIME+__CLOCK_REALTIME0 for now */
|
|
||||||
ASSERT((type == CLOCK_REALTIME) || (type == __CLOCK_REALTIME0));
|
|
||||||
|
|
||||||
getnstimeofday(tp);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(__clock_gettime);
|
|
||||||
|
|
||||||
/* This function may not be as fast as using monotonic_clock() but it
|
|
||||||
* should be much more portable, if performance becomes as issue we can
|
|
||||||
* look at using monotonic_clock() for x86_64 and x86 arches.
|
|
||||||
*/
|
*/
|
||||||
hrtime_t
|
hrtime_t
|
||||||
__gethrtime(void) {
|
__gethrtime(void) {
|
||||||
|
#ifdef HAVE_MONOTONIC_CLOCK
|
||||||
|
unsigned long long res = monotonic_clock();
|
||||||
|
|
||||||
|
/* Deal with signed/unsigned mismatch */
|
||||||
|
return (hrtime_t)(res & ~(1ULL << (BITS_PER_LONG - 1)));
|
||||||
|
#else
|
||||||
timespec_t tv;
|
timespec_t tv;
|
||||||
hrtime_t rc;
|
hrtime_t rc;
|
||||||
|
|
||||||
|
@ -64,12 +67,13 @@ __gethrtime(void) {
|
||||||
rc = (NSEC_PER_SEC * (hrtime_t)tv.tv_sec) + (hrtime_t)tv.tv_nsec;
|
rc = (NSEC_PER_SEC * (hrtime_t)tv.tv_sec) + (hrtime_t)tv.tv_nsec;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__gethrtime);
|
EXPORT_SYMBOL(__gethrtime);
|
||||||
|
|
||||||
/* set_normalized_timespec() API changes
|
/* set_normalized_timespec() API changes
|
||||||
* 2.6.0 - 2.6.15: Inline function provided by linux/time.h
|
* 2.6.0 - 2.6.15: Inline function provided by linux/time.h
|
||||||
* 2.6.16 - 2.6.25: Function prototypedefined but not exported
|
* 2.6.16 - 2.6.25: Function prototype defined but not exported
|
||||||
* 2.6.26 - 2.6.x: Function defined and exported
|
* 2.6.26 - 2.6.x: Function defined and exported
|
||||||
*/
|
*/
|
||||||
#if !defined(HAVE_SET_NORMALIZED_TIMESPEC_INLINE) && \
|
#if !defined(HAVE_SET_NORMALIZED_TIMESPEC_INLINE) && \
|
||||||
|
|
|
@ -274,7 +274,11 @@ vn_remove(const char *path, uio_seg_t seg, int flags)
|
||||||
if (nd.last_type != LAST_NORM)
|
if (nd.last_type != LAST_NORM)
|
||||||
GOTO(exit1, rc);
|
GOTO(exit1, rc);
|
||||||
|
|
||||||
|
#ifdef HAVE_INODE_I_MUTEX
|
||||||
mutex_lock_nested(&nd.nd_dentry->d_inode->i_mutex, I_MUTEX_PARENT);
|
mutex_lock_nested(&nd.nd_dentry->d_inode->i_mutex, I_MUTEX_PARENT);
|
||||||
|
#else
|
||||||
|
down(&nd.nd_dentry->d_inode->i_sem);
|
||||||
|
#endif
|
||||||
dentry = vn_lookup_hash(&nd);
|
dentry = vn_lookup_hash(&nd);
|
||||||
rc = PTR_ERR(dentry);
|
rc = PTR_ERR(dentry);
|
||||||
if (!IS_ERR(dentry)) {
|
if (!IS_ERR(dentry)) {
|
||||||
|
@ -289,7 +293,11 @@ vn_remove(const char *path, uio_seg_t seg, int flags)
|
||||||
exit2:
|
exit2:
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_INODE_I_MUTEX
|
||||||
mutex_unlock(&nd.nd_dentry->d_inode->i_mutex);
|
mutex_unlock(&nd.nd_dentry->d_inode->i_mutex);
|
||||||
|
#else
|
||||||
|
up(&nd.nd_dentry->d_inode->i_sem);
|
||||||
|
#endif
|
||||||
if (inode)
|
if (inode)
|
||||||
iput(inode); /* truncate the inode here */
|
iput(inode); /* truncate the inode here */
|
||||||
exit1:
|
exit1:
|
||||||
|
|
|
@ -357,6 +357,7 @@ fd_uninstall(int fd)
|
||||||
struct fdtable *fdt;
|
struct fdtable *fdt;
|
||||||
|
|
||||||
spin_lock(&files->file_lock);
|
spin_lock(&files->file_lock);
|
||||||
|
#ifdef HAVE_FILES_FDTABLE
|
||||||
fdt = files_fdtable(files);
|
fdt = files_fdtable(files);
|
||||||
|
|
||||||
if (fd >= fdt->max_fds)
|
if (fd >= fdt->max_fds)
|
||||||
|
@ -368,7 +369,17 @@ fd_uninstall(int fd)
|
||||||
|
|
||||||
rcu_assign_pointer(fdt->fd[fd], NULL);
|
rcu_assign_pointer(fdt->fd[fd], NULL);
|
||||||
FD_CLR(fd, fdt->close_on_exec);
|
FD_CLR(fd, fdt->close_on_exec);
|
||||||
|
#else
|
||||||
|
if (fd >= files->max_fds)
|
||||||
|
goto out_unlock;
|
||||||
|
|
||||||
|
fp = files->fd[fd];
|
||||||
|
if (!fp)
|
||||||
|
goto out_unlock;
|
||||||
|
|
||||||
|
files->fd[fd] = NULL;
|
||||||
|
FD_CLR(fd, files->close_on_exec);
|
||||||
|
#endif
|
||||||
/* Dropping the lock here exposes a minor race but it allows me
|
/* Dropping the lock here exposes a minor race but it allows me
|
||||||
* to use the existing kernel interfaces for this, and for a test
|
* to use the existing kernel interfaces for this, and for a test
|
||||||
* case I think that's reasonable. */
|
* case I think that's reasonable. */
|
||||||
|
|
Loading…
Reference in New Issue