mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Update build system and packaging
Minimal changes required to integrate the SPL sources in to the
ZFS repository build infrastructure and packaging.
Build system and packaging:
* Renamed SPL_* autoconf m4 macros to ZFS_*.
* Removed redundant SPL_* autoconf m4 macros.
* Updated the RPM spec files to remove SPL package dependency.
* The zfs package obsoletes the spl package, and the zfs-kmod
package obsoletes the spl-kmod package.
* The zfs-kmod-devel* packages were updated to add compatibility
symlinks under /usr/src/spl-x.y.z until all dependent packages
can be updated. They will be removed in a future release.
* Updated copy-builtin script for in-kernel builds.
* Updated DKMS package to include the spl.ko.
* Updated stale AUTHORS file to include all contributors.
* Updated stale COPYRIGHT and included the SPL as an exception.
* Renamed README.markdown to README.md
* Renamed OPENSOLARIS.LICENSE to LICENSE.
* Renamed DISCLAIMER to NOTICE.
Required code changes:
* Removed redundant HAVE_SPL macro.
* Removed _BOOT from nvpairs since it doesn't apply for Linux.
* Initial header cleanup (removal of empty headers, refactoring).
* Remove SPL repository clone/build from zimport.sh.
* Use of DEFINE_RATELIMIT_STATE and DEFINE_SPINLOCK removed due
to build issues when forcing C99 compilation.
* Replaced legacy ACCESS_ONCE with READ_ONCE.
* Include needed headers for `current` and `EXPORT_SYMBOL`.
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
TEST_ZIMPORT_SKIP="yes"
Closes #7556
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
src = @abs_top_srcdir@/module/spl
|
||||
obj = @abs_builddir@
|
||||
|
||||
MODULE := spl
|
||||
|
||||
obj-$(CONFIG_ZFS) := $(MODULE).o
|
||||
|
||||
ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
|
||||
|
||||
$(MODULE)-objs += spl-atomic.o
|
||||
$(MODULE)-objs += spl-condvar.o
|
||||
$(MODULE)-objs += spl-cred.o
|
||||
$(MODULE)-objs += spl-err.o
|
||||
$(MODULE)-objs += spl-generic.o
|
||||
$(MODULE)-objs += spl-kmem.o
|
||||
$(MODULE)-objs += spl-kmem-cache.o
|
||||
$(MODULE)-objs += spl-kobj.o
|
||||
$(MODULE)-objs += spl-kstat.o
|
||||
$(MODULE)-objs += spl-mutex.o
|
||||
$(MODULE)-objs += spl-proc.o
|
||||
$(MODULE)-objs += spl-rwlock.o
|
||||
$(MODULE)-objs += spl-taskq.o
|
||||
$(MODULE)-objs += spl-thread.o
|
||||
$(MODULE)-objs += spl-tsd.o
|
||||
$(MODULE)-objs += spl-vmem.o
|
||||
$(MODULE)-objs += spl-vnode.o
|
||||
$(MODULE)-objs += spl-xdr.o
|
||||
$(MODULE)-objs += spl-zlib.o
|
||||
@@ -0,0 +1,16 @@
|
||||
The Solaris Porting Layer, SPL, is a Linux kernel module which provides a
|
||||
compatibility layer used by the [ZFS on Linux](http://zfsonlinux.org) project.
|
||||
|
||||
# Installation
|
||||
|
||||
The latest version of the SPL is maintained as part of this repository.
|
||||
Only when building ZFS version 0.7.x or earlier must an external SPL release
|
||||
be used. These releases can be found at:
|
||||
|
||||
* Version 0.7.x: https://github.com/zfsonlinux/spl/tree/spl-0.7-release
|
||||
* Version 0.6.5.x: https://github.com/zfsonlinux/spl/tree/spl-0.6.5-release
|
||||
|
||||
# Release
|
||||
|
||||
The SPL is released under a GPLv2 license.
|
||||
For more details see the NOTICE and THIRDPARTYLICENSE files; `UCRL-CODE-235197`
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <sys/condvar.h>
|
||||
#include <sys/time.h>
|
||||
#include <linux/hrtimer.h>
|
||||
#include <linux/compiler_compat.h>
|
||||
|
||||
void
|
||||
__cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg)
|
||||
@@ -89,7 +90,7 @@ cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state, int io)
|
||||
ASSERT(mutex_owned(mp));
|
||||
atomic_inc(&cvp->cv_refs);
|
||||
|
||||
m = ACCESS_ONCE(cvp->cv_mutex);
|
||||
m = READ_ONCE(cvp->cv_mutex);
|
||||
if (!m)
|
||||
m = xchg(&cvp->cv_mutex, mp);
|
||||
/* Ensure the same mutex is used by all callers */
|
||||
@@ -202,7 +203,7 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time,
|
||||
return (-1);
|
||||
|
||||
atomic_inc(&cvp->cv_refs);
|
||||
m = ACCESS_ONCE(cvp->cv_mutex);
|
||||
m = READ_ONCE(cvp->cv_mutex);
|
||||
if (!m)
|
||||
m = xchg(&cvp->cv_mutex, mp);
|
||||
/* Ensure the same mutex is used by all callers */
|
||||
@@ -290,7 +291,7 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t expire_time,
|
||||
return (-1);
|
||||
|
||||
atomic_inc(&cvp->cv_refs);
|
||||
m = ACCESS_ONCE(cvp->cv_mutex);
|
||||
m = READ_ONCE(cvp->cv_mutex);
|
||||
if (!m)
|
||||
m = xchg(&cvp->cv_mutex, mp);
|
||||
/* Ensure the same mutex is used by all callers */
|
||||
|
||||
+2
-11
@@ -26,7 +26,6 @@
|
||||
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/cmn_err.h>
|
||||
#include <linux/ratelimit.h>
|
||||
|
||||
/*
|
||||
* It is often useful to actually have the panic crash the node so you
|
||||
@@ -40,19 +39,11 @@ module_param(spl_panic_halt, uint, 0644);
|
||||
MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures");
|
||||
/* END CSTYLED */
|
||||
|
||||
/*
|
||||
* Limit the number of stack traces dumped to not more than 5 every
|
||||
* 60 seconds to prevent denial-of-service attacks from debug code.
|
||||
*/
|
||||
DEFINE_RATELIMIT_STATE(dumpstack_ratelimit_state, 60 * HZ, 5);
|
||||
|
||||
void
|
||||
spl_dumpstack(void)
|
||||
{
|
||||
if (__ratelimit(&dumpstack_ratelimit_state)) {
|
||||
printk("Showing stack for process %d\n", current->pid);
|
||||
dump_stack();
|
||||
}
|
||||
printk("Showing stack for process %d\n", current->pid);
|
||||
dump_stack();
|
||||
}
|
||||
EXPORT_SYMBOL(spl_dumpstack);
|
||||
|
||||
|
||||
@@ -46,12 +46,13 @@
|
||||
#include <sys/strings.h>
|
||||
#include <linux/kmod.h>
|
||||
|
||||
char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE;
|
||||
char spl_version[32] = "SPL v" ZFS_META_VERSION "-" ZFS_META_RELEASE;
|
||||
EXPORT_SYMBOL(spl_version);
|
||||
|
||||
/* BEGIN CSTYLED */
|
||||
unsigned long spl_hostid = 0;
|
||||
EXPORT_SYMBOL(spl_hostid);
|
||||
/* BEGIN CSTYLED */
|
||||
module_param(spl_hostid, ulong, 0644);
|
||||
MODULE_PARM_DESC(spl_hostid, "The system hostid.");
|
||||
/* END CSTYLED */
|
||||
@@ -719,8 +720,6 @@ spl_init(void)
|
||||
if ((rc = spl_zlib_init()))
|
||||
goto out10;
|
||||
|
||||
printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION,
|
||||
SPL_META_RELEASE, SPL_DEBUG_STR);
|
||||
return (rc);
|
||||
|
||||
out10:
|
||||
@@ -742,18 +741,12 @@ out3:
|
||||
out2:
|
||||
spl_kvmem_fini();
|
||||
out1:
|
||||
printk(KERN_NOTICE "SPL: Failed to Load Solaris Porting Layer "
|
||||
"v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE,
|
||||
SPL_DEBUG_STR, rc);
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static void __exit
|
||||
spl_fini(void)
|
||||
{
|
||||
printk(KERN_NOTICE "SPL: Unloaded module v%s-%s%s\n",
|
||||
SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR);
|
||||
spl_zlib_fini();
|
||||
spl_kstat_fini();
|
||||
spl_proc_fini();
|
||||
@@ -770,6 +763,6 @@ module_init(spl_init);
|
||||
module_exit(spl_fini);
|
||||
|
||||
MODULE_DESCRIPTION("Solaris Porting Layer");
|
||||
MODULE_AUTHOR(SPL_META_AUTHOR);
|
||||
MODULE_LICENSE(SPL_META_LICENSE);
|
||||
MODULE_VERSION(SPL_META_VERSION "-" SPL_META_RELEASE);
|
||||
MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
|
||||
+4
-16
@@ -27,7 +27,6 @@
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/vmem.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/ratelimit.h>
|
||||
|
||||
/*
|
||||
* As a general rule kmem_alloc() allocations should be small, preferably
|
||||
@@ -134,12 +133,6 @@ strfree(char *str)
|
||||
}
|
||||
EXPORT_SYMBOL(strfree);
|
||||
|
||||
/*
|
||||
* Limit the number of large allocation stack traces dumped to not more than
|
||||
* 5 every 60 seconds to prevent denial-of-service attacks from debug code.
|
||||
*/
|
||||
DEFINE_RATELIMIT_STATE(kmem_alloc_ratelimit_state, 60 * HZ, 5);
|
||||
|
||||
/*
|
||||
* General purpose unified implementation of kmem_alloc(). It is an
|
||||
* amalgamation of Linux and Illumos allocator design. It should never be
|
||||
@@ -160,7 +153,7 @@ spl_kmem_alloc_impl(size_t size, int flags, int node)
|
||||
* through the vmem_alloc()/vmem_zalloc() interfaces.
|
||||
*/
|
||||
if ((spl_kmem_alloc_warn > 0) && (size > spl_kmem_alloc_warn) &&
|
||||
!(flags & KM_VMEM) && __ratelimit(&kmem_alloc_ratelimit_state)) {
|
||||
!(flags & KM_VMEM)) {
|
||||
printk(KERN_WARNING
|
||||
"Large kmem_alloc(%lu, 0x%x), please file an issue at:\n"
|
||||
"https://github.com/zfsonlinux/zfs/issues/new\n",
|
||||
@@ -207,14 +200,6 @@ spl_kmem_alloc_impl(size_t size, int flags, int node)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (unlikely(__ratelimit(&kmem_alloc_ratelimit_state))) {
|
||||
printk(KERN_WARNING
|
||||
"Possible memory allocation deadlock: "
|
||||
"size=%lu lflags=0x%x",
|
||||
(unsigned long)size, lflags);
|
||||
dump_stack();
|
||||
}
|
||||
|
||||
/*
|
||||
* Use cond_resched() instead of congestion_wait() to avoid
|
||||
* deadlocking systems where there are no block devices.
|
||||
@@ -535,9 +520,12 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock)
|
||||
int
|
||||
spl_kmem_init(void)
|
||||
{
|
||||
|
||||
#ifdef DEBUG_KMEM
|
||||
kmem_alloc_used_set(0);
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG_KMEM_TRACKING
|
||||
spl_kmem_init_tracking(&kmem_list, &kmem_lock, KMEM_TABLE_SIZE);
|
||||
#endif /* DEBUG_KMEM_TRACKING */
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/rwlock.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#if defined(CONFIG_PREEMPT_RT_FULL)
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ static taskq_thread_t *taskq_thread_create(taskq_t *);
|
||||
|
||||
/* List of all taskqs */
|
||||
LIST_HEAD(tq_list);
|
||||
DECLARE_RWSEM(tq_list_sem);
|
||||
struct rw_semaphore tq_list_sem;
|
||||
static uint_t taskq_tsd;
|
||||
|
||||
static int
|
||||
@@ -1257,6 +1257,7 @@ MODULE_PARM_DESC(spl_taskq_kick,
|
||||
int
|
||||
spl_taskq_init(void)
|
||||
{
|
||||
init_rwsem(&tq_list_sem);
|
||||
tsd_create(&taskq_tsd, NULL);
|
||||
|
||||
system_taskq = taskq_create("spl_system_taskq", MAX(boot_ncpus, 64),
|
||||
|
||||
@@ -40,7 +40,7 @@ EXPORT_SYMBOL(rootdir);
|
||||
static spl_kmem_cache_t *vn_cache;
|
||||
static spl_kmem_cache_t *vn_file_cache;
|
||||
|
||||
static DEFINE_SPINLOCK(vn_file_lock);
|
||||
static spinlock_t vn_file_lock;
|
||||
static LIST_HEAD(vn_file_list);
|
||||
|
||||
static int
|
||||
@@ -744,6 +744,8 @@ vn_file_cache_destructor(void *buf, void *cdrarg)
|
||||
int
|
||||
spl_vn_init(void)
|
||||
{
|
||||
vn_file_lock = __SPIN_LOCK_UNLOCKED(vn_file_lock);
|
||||
|
||||
vn_cache = kmem_cache_create("spl_vn_cache",
|
||||
sizeof (struct vnode), 64, vn_cache_constructor,
|
||||
vn_cache_destructor, NULL, NULL, NULL, 0);
|
||||
|
||||
@@ -131,8 +131,6 @@
|
||||
static struct xdr_ops xdrmem_encode_ops;
|
||||
static struct xdr_ops xdrmem_decode_ops;
|
||||
|
||||
typedef int bool_t;
|
||||
|
||||
void
|
||||
xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size,
|
||||
const enum xdr_op op)
|
||||
|
||||
Reference in New Issue
Block a user