summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-kernel/spl
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-kernel/spl')
-rw-r--r--sys-kernel/spl/Manifest13
-rw-r--r--sys-kernel/spl/files/spl-0.6.0_rc13-fix-on_each_cpu-autotools-check.patch46
-rw-r--r--sys-kernel/spl/files/spl-0.6.0_rc13-fix-soft-lockup.patch179
-rw-r--r--sys-kernel/spl/files/spl-0.6.0_rc14-fix-atomic64-checks.patch70
-rw-r--r--sys-kernel/spl/files/spl-0.6.0_rc14-fix-mutex-owner-check.patch33
-rw-r--r--sys-kernel/spl/files/spl-0.6.0_rc14-linux-3.9-compat.patch237
-rw-r--r--sys-kernel/spl/files/spl-0.6.0_rc14-no-cond_resched.patch38
-rw-r--r--sys-kernel/spl/files/spl-0.6.0_rc14-simplify-hostid-logic.patch181
-rw-r--r--sys-kernel/spl/files/spl-0.6.0_rc9-alias-km-sleep-with-km-pushpage.patch56
-rw-r--r--sys-kernel/spl/files/spl-0.6.1-builtin-fix.patch28
-rw-r--r--sys-kernel/spl/files/spl-0.6.1-constify-ctl_table.patch63
-rw-r--r--sys-kernel/spl/files/spl-0.6.1-fix-delay.patch33
-rw-r--r--sys-kernel/spl/files/spl-0.6.1-linux-3.10-compat.patch426
-rw-r--r--sys-kernel/spl/metadata.xml14
-rw-r--r--sys-kernel/spl/spl-0.6.0_rc13-r2.ebuild114
-rw-r--r--sys-kernel/spl/spl-0.6.0_rc14-r3.ebuild125
-rw-r--r--sys-kernel/spl/spl-0.6.1-r3.ebuild126
-rw-r--r--sys-kernel/spl/spl-0.6.2-r1.ebuild113
-rw-r--r--sys-kernel/spl/spl-0.6.2-r2.ebuild113
-rw-r--r--sys-kernel/spl/spl-0.6.2-r3.ebuild113
-rw-r--r--sys-kernel/spl/spl-0.6.2-r4.ebuild113
-rw-r--r--sys-kernel/spl/spl-0.6.2-r5.ebuild113
-rw-r--r--sys-kernel/spl/spl-0.6.2.ebuild110
-rw-r--r--sys-kernel/spl/spl-0.6.3-r1.ebuild125
-rw-r--r--sys-kernel/spl/spl-0.6.3.ebuild117
-rw-r--r--sys-kernel/spl/spl-0.6.4.2.ebuild114
-rw-r--r--sys-kernel/spl/spl-0.6.4.ebuild114
-rw-r--r--sys-kernel/spl/spl-9999.ebuild117
28 files changed, 3044 insertions, 0 deletions
diff --git a/sys-kernel/spl/Manifest b/sys-kernel/spl/Manifest
new file mode 100644
index 000000000000..88e4f755f8b1
--- /dev/null
+++ b/sys-kernel/spl/Manifest
@@ -0,0 +1,13 @@
+DIST spl-0.6.0-rc13.tar.gz 210192 SHA256 500d9c9297f2b7abdc4fce43efe05dddda2edbe403f9ca76d01ae632f798ee1f SHA512 630b63c15e98ada397bc8b8a1a5b6a48255ffa5d7fad8dd0ed9ad7fbede32f3557651effcc99234ffef1a1b9bb13e289c0ca5a2cf60307e0a57ac3a93b709f6b WHIRLPOOL 9330dd1567421e610a714b69d096bbae66c102baaf90fa3daed45cc1a2928eb3dd0e8537f3cf83a7fb2b157bf52ff37b031bcf6c9f52760acd6e480ad335b69a
+DIST spl-0.6.0-rc14.tar.gz 210495 SHA256 92785e2c2c6caf93ec31175e192a18b27458613a99e6578041f6029875b061e3 SHA512 85d066a97d62ce60f60c552d121c20d5a719e95e0eb6d7ec1b10e29acca1e3429a751bcbb811e9cee2a14282c8908684cb9ee0df9cbc8e53ddfe47da18df4cf9 WHIRLPOOL 6473236476dd9a2d392e2f71fee6810ed83e68f309d1eaaa5fbad1f73ae567ad629db97a2bc81a4ad9e28991f4be3d4100c1b9ab0f65941206afe6e5b03f64ab
+DIST spl-0.6.1.tar.gz 213191 SHA256 24d73eeeb0b08bcc162342c5236f116b90ed0a2e69344ae34de744f61c2e3663 SHA512 116117235b4730b5e7041107188747fa2872fb204a08d67a03e1ec95d6302ca57aa17edd12e6f9284492a844e60d446a25d1172d7a2ce53075c36bd889879b31 WHIRLPOOL 4554eb9ba4a2b60fbfc7d73ada4b5c7ce20b26d6655f0a8d9fe5479d11124acc27cf2ba6eab5af4e4a08c886b06687dcbb656322c8e26c43f07b4066770f9a4d
+DIST spl-0.6.2-p0.tar.xz 3740 SHA256 e07570e0141d0563f38c0eb48c2a43432720f03e805ed0bbc16b657826f8f0fb SHA512 512690cbde850e57b25bdff633efb33838d08591c1923cf8e01d15e0b84e7730fc12f7d64dc39c90d1a6d74e8e344065b86465d2d7651ed4974baa5c99aecca8 WHIRLPOOL 10944742881f92d041f7ed3054cf6a22373919a6a469b2ef6c4e83772c8197139339b8994f4bcbd449b4f33e629854a51240f6dad77bc5e690b76b9f7acac0ba
+DIST spl-0.6.2-p1.tar.xz 6552 SHA256 1784bccdd889dc7e2caa0b37a57d98d3db1b451043238b8c3b8af5da4bd84964 SHA512 12ae76e28a8fbf2d7051049be8a9226230a85b7cf8126839b3c285d7af01a7e4a12dbad33c94ed1edd2cbd9fa0392e9df499522f356dc1329579e76debeb7099 WHIRLPOOL 7c04bc7ae60f830b8c44ea2472a006a5cd81c8e0c3cafbf919f5d6e8088498362ea60c44c93b63af32e54c56b958e9edb35e8c37192efb6189d0da9d280f4e1c
+DIST spl-0.6.2-p2.tar.xz 8264 SHA256 2fb106eda86a19aa01ff33a74bc71e84facba82f67efb23cfbeb9f90d0653a93 SHA512 1f2484637a624e37859da8295f6301f755cf7abd3c4e4c4db815bc430e0adf03a26432d5004c76715869301a4dcf2affe789ed8c1b1a62dd97ca6f5a8d45abc3 WHIRLPOOL d3e335c30032082634668a259bec43ab72cd12da2f21b6fc83ad3bf2a2f93048edb7fd95a6f5bf09249eed178f0d34c016a96a1d7b2dc28298183fd535a1be18
+DIST spl-0.6.2-p3.tar.xz 8676 SHA256 8544b8f4bcbb29b61cae58d750fc442683a1ed200b58d90c7e0886eb812b3dc2 SHA512 a298765a1cb396192a08b2f8e4a1cffdbf50e3b720ae48b262958659386efa0ad4fc4550192c8bf672abc5a1c309ff2b1b6d64307bfb0ab29023a0adfa9ac858 WHIRLPOOL ca9e97e0fb52b5506fd3f410ef00fab05cfb01aed4727702c52e31f527967ae6c22d8bafb8f8faf039e937f5f32d446ef05c04e0adf0b8c8acfe26ff18507a75
+DIST spl-0.6.2-p4.tar.xz 9076 SHA256 8b434bb53da79c5adb5339b36bddf4d19c4e8d5df7a8a5d2a4ca1bcf7336094e SHA512 77ca1ce0235edb85cf36243ad45710ee8759dcc49bacddc661a986d558eb9cd92671ce256c88287e056732882a038b12bb0d9ae131229819702a06de18c50bc1 WHIRLPOOL afc335ba0a7d24a610f272e6a65460326b91ab91652bf66525e14110a811b2490de65847560989f793aab8d473794c56836e438cb7f1e19d4e253373178f0a72
+DIST spl-0.6.2.tar.gz 215032 SHA256 a8147eaba030ca71bf8c47b46a2c7ae92f9b4ef60aa8ccfa7368f395faeb85ac SHA512 ef5b77046259ec754e0a41f90b51c27207bf91e832d54a8502232b19cfaff711de301f24945ca739faeac2544b3ef22a57f58cf6298d756a1ebaff06f765b8a9 WHIRLPOOL ab7229691a6f56ab3f98513fd0e32048c11dd7cf3ea61e438bac2d97ebd8cd92eeeb422ef1c4e639572feb3e8f69c0840b861f654ca31de481601ef54295be37
+DIST spl-0.6.3-patches-r1.tar.xz 15996 SHA256 7f1cf74c9be5c14eeff529ce0a45d7dcca33cc08e5b9e7d17fc79dd5a58719d7 SHA512 6eeee3a18466bbe8ca903910d807a3242bff0c12848d4fc6e226fe40592cd6cd9109bc5ee301867f0512b5cf2ad28eab2988e261c69fd200c5dd6eb6d8027b2c WHIRLPOOL 93578cfa435dc343edc8087a0d49aa90ddc457bf75292b0c10ce30836e00f27ea0c4768a62270a6ec559238b778ccfcde71c15740a8242f9f93c7d84934c5f72
+DIST spl-0.6.3.tar.gz 221430 SHA256 5d60dfbe86a50e65dbce17f538d8d0874a0cc293374f59eed46cd2dd1809a944 SHA512 c4b82f1e279c7581d0082c044157e8a933edf53233c8c7c8202117454cfda0473ab85fbb56ac0b6da09a4d6798e33020a9c55bf23e25d630efa3265545c3defc WHIRLPOOL eaf001a96a80264e16ce416da38b988eabbfd2fce17690151a496a3141c32e92e5d00791e2d9c009ae0cf6910f80434c10f02a700752fc664f6bf6723bb03dba
+DIST spl-0.6.4.2.tar.gz 190421 SHA256 05c428f48acc55287c0662a90cfc087985b8ef3694dc057cfb16e1fa2ebbda43 SHA512 6a295651622dd1819bc9ef8f693c6a3cf73dbb084a4789ad508dda644bfcaa1984c5487ea0e16c8d6d468da59a3fae2e9309b2b13cd869a4af4ea675c394bbe3 WHIRLPOOL e270b66ac9e22c806876e727ef040c3cfb2c304889de982f1c54a1625f7bf0214d3b6f8baac42cb3710aa23897f1b1bc67ef633fe35cb1b2c4b57196390a0fad
+DIST spl-0.6.4.tar.gz 190348 SHA256 290c20cec89161a0e3e3a885494dfb7b0b7defbe38006cb2ecfdf2b241136415 SHA512 4dda082170884811a2667ecdc130e9e3743bf362109bebb53bd69a18115b8e2b41305d212a03f4233258f866fe7c56ed4a3f08fc1814fa1f8e947b5305a056ab WHIRLPOOL 475593c4b0f75fb30c963196bf6e45219b4a57bd8c9d4350f02ff358c97a69f066b5d4ce8cb346b67d773d7ff985e1812925a5490b8911b9cd657e654772bb9f
diff --git a/sys-kernel/spl/files/spl-0.6.0_rc13-fix-on_each_cpu-autotools-check.patch b/sys-kernel/spl/files/spl-0.6.0_rc13-fix-on_each_cpu-autotools-check.patch
new file mode 100644
index 000000000000..e8eaa385c642
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.0_rc13-fix-on_each_cpu-autotools-check.patch
@@ -0,0 +1,46 @@
+From 050cd84e628e5d827a0b345cda12b97253fccd37 Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Date: Mon, 7 Jan 2013 14:09:09 -0800
+Subject: [PATCH] Linux compat 3.7.1, on_each_cpu()
+
+Some kernels require that we include the 'linux/irqflags.h'
+header for the SPL_AC_3ARGS_ON_EACH_CPU check. Otherwise,
+the functions local_irq_enable()/local_irq_disable() will not
+be defined and the prototype will be misdetected as the four
+argument version.
+
+This change actually include 'linux/interrupt.h' which in turn
+includes 'linux/irqflags.h' to be as generic as possible.
+
+Additionally, passing NULL as the function can result in a
+gcc error because the on_each_cpu() macro executes it
+unconditionally. To make the test more robust we pass the
+dummy function on_each_cpu_func().
+
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes #204
+---
+ config/spl-build.m4 | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/config/spl-build.m4 b/config/spl-build.m4
+index f710d8e..6e4afed 100644
+--- a/config/spl-build.m4
++++ b/config/spl-build.m4
+@@ -1312,9 +1312,12 @@ dnl #
+ AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
+ AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
+ SPL_LINUX_TRY_COMPILE([
++ #include <linux/interrupt.h>
+ #include <linux/smp.h>
++
++ void on_each_cpu_func(void *data) { return; }
+ ],[
+- on_each_cpu(NULL, NULL, 0);
++ on_each_cpu(on_each_cpu_func, NULL, 0);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
+--
+1.7.10
+
diff --git a/sys-kernel/spl/files/spl-0.6.0_rc13-fix-soft-lockup.patch b/sys-kernel/spl/files/spl-0.6.0_rc13-fix-soft-lockup.patch
new file mode 100644
index 000000000000..99227feb04a2
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.0_rc13-fix-soft-lockup.patch
@@ -0,0 +1,179 @@
+From d4899f4747fd03be748fd1a589b9db5786fa1375 Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Date: Fri, 11 Jan 2013 14:29:32 -0800
+Subject: [PATCH] kmem-cache: Fix slab ageing soft lockup
+
+Commit a10287e00d13c4c4dbbff14f42b00b03da363fcb slightly reworked
+the slab ageing code such that it is no longer dependent on the
+Linux delayed work queue interfaces.
+
+This was good for portability and performance, but it requires us
+to use the on_each_cpu() function to execute the spl_magazine_age()
+function. That means that the function is now executing in interrupt
+context whereas before it was scheduled in normal process context.
+And that means we need to be slightly more careful about the locking
+in the interrupt handler.
+
+With the reworked code it's possible that we'll be holding the
+skc->skc_lock and be interrupted to handle the spl_magazine_age()
+IRQ. This will result in a deadlock and soft lockup errors unless
+we're careful to detect the contention and avoid taking the lock in
+the interupt handler. So that's what this patch does.
+
+Alternately, (and slightly more conventionally) we could have used
+spin_lock_irqsave() to prevent this race entirely but I'd perfer to
+avoid disabling interrupts as much as possible due to performance
+concerns. There is absolutely no penalty for us not aging objects
+out of the magazine due to contention.
+
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Signed-off-by: Prakash Surya <surya1@llnl.gov>
+Closes zfsonlinux/zfs#1193
+---
+ module/spl/spl-kmem.c | 94 +++++++++++++++++++++++++++----------------------
+ 1 file changed, 51 insertions(+), 43 deletions(-)
+
+diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
+index bc08a55..cc5961e 100644
+--- a/module/spl/spl-kmem.c
++++ b/module/spl/spl-kmem.c
+@@ -827,8 +827,7 @@ char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap)
+ struct rw_semaphore spl_kmem_cache_sem; /* Cache list lock */
+ taskq_t *spl_kmem_cache_taskq; /* Task queue for ageing / reclaim */
+
+-static int spl_cache_flush(spl_kmem_cache_t *skc,
+- spl_kmem_magazine_t *skm, int flush);
++static void spl_cache_shrink(spl_kmem_cache_t *skc, void *obj);
+
+ SPL_SHRINKER_CALLBACK_FWD_DECLARE(spl_kmem_cache_generic_shrinker);
+ SPL_SHRINKER_DECLARE(spl_kmem_cache_shrinker,
+@@ -1244,6 +1243,38 @@ static int spl_cache_flush(spl_kmem_cache_t *skc,
+ SRETURN(0);
+ }
+
++/*
++ * Release objects from the per-cpu magazine back to their slab. The flush
++ * argument contains the max number of entries to remove from the magazine.
++ */
++static void
++__spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush)
++{
++ int i, count = MIN(flush, skm->skm_avail);
++ SENTRY;
++
++ ASSERT(skc->skc_magic == SKC_MAGIC);
++ ASSERT(skm->skm_magic == SKM_MAGIC);
++ ASSERT(spin_is_locked(&skc->skc_lock));
++
++ for (i = 0; i < count; i++)
++ spl_cache_shrink(skc, skm->skm_objs[i]);
++
++ skm->skm_avail -= count;
++ memmove(skm->skm_objs, &(skm->skm_objs[count]),
++ sizeof(void *) * skm->skm_avail);
++
++ SEXIT;
++}
++
++static void
++spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush)
++{
++ spin_lock(&skc->skc_lock);
++ __spl_cache_flush(skc, skm, flush);
++ spin_unlock(&skc->skc_lock);
++}
++
+ static void
+ spl_magazine_age(void *data)
+ {
+@@ -1252,10 +1283,23 @@ static int spl_cache_flush(spl_kmem_cache_t *skc,
+
+ ASSERT(skm->skm_magic == SKM_MAGIC);
+ ASSERT(skm->skm_cpu == smp_processor_id());
++ ASSERT(irqs_disabled());
++
++ /* There are no available objects or they are too young to age out */
++ if ((skm->skm_avail == 0) ||
++ time_before(jiffies, skm->skm_age + skc->skc_delay * HZ))
++ return;
+
+- if (skm->skm_avail > 0)
+- if (time_after(jiffies, skm->skm_age + skc->skc_delay * HZ))
+- (void) spl_cache_flush(skc, skm, skm->skm_refill);
++ /*
++ * Because we're executing in interrupt context we may have
++ * interrupted the holder of this lock. To avoid a potential
++ * deadlock return if the lock is contended.
++ */
++ if (!spin_trylock(&skc->skc_lock))
++ return;
++
++ __spl_cache_flush(skc, skm, skm->skm_refill);
++ spin_unlock(&skc->skc_lock);
+ }
+
+ /*
+@@ -1451,7 +1495,7 @@ static int spl_cache_flush(spl_kmem_cache_t *skc,
+
+ for_each_online_cpu(i) {
+ skm = skc->skc_mag[i];
+- (void)spl_cache_flush(skc, skm, skm->skm_avail);
++ spl_cache_flush(skc, skm, skm->skm_avail);
+ spl_magazine_free(skm);
+ }
+
+@@ -1932,42 +1976,6 @@ static int spl_cache_flush(spl_kmem_cache_t *skc,
+ }
+
+ /*
+- * Release a batch of objects from a per-cpu magazine back to their
+- * respective slabs. This occurs when we exceed the magazine size,
+- * are under memory pressure, when the cache is idle, or during
+- * cache cleanup. The flush argument contains the number of entries
+- * to remove from the magazine.
+- */
+-static int
+-spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush)
+-{
+- int i, count = MIN(flush, skm->skm_avail);
+- SENTRY;
+-
+- ASSERT(skc->skc_magic == SKC_MAGIC);
+- ASSERT(skm->skm_magic == SKM_MAGIC);
+-
+- /*
+- * XXX: Currently we simply return objects from the magazine to
+- * the slabs in fifo order. The ideal thing to do from a memory
+- * fragmentation standpoint is to cheaply determine the set of
+- * objects in the magazine which will result in the largest
+- * number of free slabs if released from the magazine.
+- */
+- spin_lock(&skc->skc_lock);
+- for (i = 0; i < count; i++)
+- spl_cache_shrink(skc, skm->skm_objs[i]);
+-
+- skm->skm_avail -= count;
+- memmove(skm->skm_objs, &(skm->skm_objs[count]),
+- sizeof(void *) * skm->skm_avail);
+-
+- spin_unlock(&skc->skc_lock);
+-
+- SRETURN(count);
+-}
+-
+-/*
+ * Allocate an object from the per-cpu magazine, or if the magazine
+ * is empty directly allocate from a slab and repopulate the magazine.
+ */
+@@ -2053,7 +2061,7 @@ static int spl_cache_flush(spl_kmem_cache_t *skc,
+
+ /* Per-CPU cache full, flush it to make space */
+ if (unlikely(skm->skm_avail >= skm->skm_size))
+- (void)spl_cache_flush(skc, skm, skm->skm_refill);
++ spl_cache_flush(skc, skm, skm->skm_refill);
+
+ /* Available space in cache, use it */
+ skm->skm_objs[skm->skm_avail++] = obj;
+--
+1.7.10
+
diff --git a/sys-kernel/spl/files/spl-0.6.0_rc14-fix-atomic64-checks.patch b/sys-kernel/spl/files/spl-0.6.0_rc14-fix-atomic64-checks.patch
new file mode 100644
index 000000000000..9ac8a4308dd6
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.0_rc14-fix-atomic64-checks.patch
@@ -0,0 +1,70 @@
+From dd3678fc29d75286b57e705454bbd7e60e1b44e0 Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Date: Tue, 5 Feb 2013 09:35:43 -0800
+Subject: [PATCH] Fix atomic64_* autoconf checks
+
+The SPL_AC_ATOMIC_SPINLOCK, SPL_AC_TYPE_ATOMIC64_CMPXCHG, and
+SPL_AC_TYPE_ATOMIC64_XCHG were all directly including the
+'asm/atomic.h' header. As of Linux 3.4 this header was removed
+which results in a build failure.
+
+The right thing to do is include 'linux/atomic.h' however we
+can't safely do this because it doesn't exist in 2.6.26 kernels.
+Therefore, we include 'linux/fs.h' which in turn includes the
+correct atomic header regardless of the kernel version.
+
+When these incorrect APIs are used in ZFS the following build
+failure results.
+
+ arc.c:791:80: warning: '__ret' may be used uninitialized
+ in this function [-Wuninitialized]
+ arc.c:791:1875: error: call to '__cmpxchg_wrong_size'
+ declared with attribute error: Bad argument size for cmpxchg
+
+Since this is all Linux 2.6.24 compatibility code there's
+an argument to be made that it should be removed because
+kernels this old are not supported. However, because we're
+so close to a release I'm going to leave it in place for now.
+
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes zfsonlinux/zfs#814
+Closes zfsonlinux/zfs#1254
+---
+ config/spl-build.m4 | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/config/spl-build.m4 b/config/spl-build.m4
+index e9695de..8518404 100644
+--- a/config/spl-build.m4
++++ b/config/spl-build.m4
+@@ -777,7 +777,7 @@ AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
+ [enable_atomic_spinlocks=check])
+
+ SPL_LINUX_TRY_COMPILE([
+- #include <asm/atomic.h>
++ #include <linux/fs.h>
+ ],[
+ atomic64_t *ptr __attribute__ ((unused));
+ ],[
+@@ -820,8 +820,7 @@ dnl #
+ AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG],
+ [AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
+ SPL_LINUX_TRY_COMPILE([
+- #include <asm/atomic.h>
+- #include <asm/system.h>
++ #include <linux/fs.h>
+ ],[
+ atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
+ ],[
+@@ -840,7 +839,7 @@ dnl #
+ AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG],
+ [AC_MSG_CHECKING([whether kernel defines atomic64_xchg])
+ SPL_LINUX_TRY_COMPILE([
+- #include <asm/atomic.h>
++ #include <linux/fs.h>
+ ],[
+ atomic64_xchg((atomic64_t *)NULL, 0);
+ ],[
+--
+1.7.10
+
diff --git a/sys-kernel/spl/files/spl-0.6.0_rc14-fix-mutex-owner-check.patch b/sys-kernel/spl/files/spl-0.6.0_rc14-fix-mutex-owner-check.patch
new file mode 100644
index 000000000000..ee7314d3cf32
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.0_rc14-fix-mutex-owner-check.patch
@@ -0,0 +1,33 @@
+From a0625691b39468d04eb716919e237f96a3987b48 Mon Sep 17 00:00:00 2001
+From: Richard Yao <ryao@cs.stonybrook.edu>
+Date: Tue, 5 Feb 2013 16:42:29 -0500
+Subject: [PATCH] Fix HAVE_MUTEX_OWNER_TASK_STRUCT autotools check on PPC64
+
+The HAVE_MUTEX_OWNER_TASK_STRUCT fails on PPC64 with the following
+error:
+
+error: 'current' undeclared (first use in this function)
+
+We include linux/sched.h to ensure that current is available.
+
+Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+---
+ config/spl-build.m4 | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/config/spl-build.m4 b/config/spl-build.m4
+index 8518404..4cb7e1d 100644
+--- a/config/spl-build.m4
++++ b/config/spl-build.m4
+@@ -1269,6 +1269,7 @@ AC_DEFUN([SPL_AC_MUTEX_OWNER_TASK_STRUCT], [
+ EXTRA_KCFLAGS="-Werror"
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/mutex.h>
++ #include <linux/sched.h>
+ ],[
+ struct mutex mtx __attribute__ ((unused));
+ mtx.owner = current;
+--
+1.7.10
+
diff --git a/sys-kernel/spl/files/spl-0.6.0_rc14-linux-3.9-compat.patch b/sys-kernel/spl/files/spl-0.6.0_rc14-linux-3.9-compat.patch
new file mode 100644
index 000000000000..5f9a4c698803
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.0_rc14-linux-3.9-compat.patch
@@ -0,0 +1,237 @@
+diff --git a/config/spl-build.m4 b/config/spl-build.m4
+index 3dcc05e..6a8e658 100644
+--- a/config/spl-build.m4
++++ b/config/spl-build.m4
+@@ -64,6 +64,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
+ SPL_AC_USER_PATH_DIR
+ SPL_AC_SET_FS_PWD
+ SPL_AC_2ARGS_SET_FS_PWD
++ SPL_AC_SET_FS_PWD_WITH_CONST
+ SPL_AC_2ARGS_VFS_UNLINK
+ SPL_AC_4ARGS_VFS_RENAME
+ SPL_AC_VFS_FSYNC
+@@ -88,6 +89,8 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
+ SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
+ SPL_AC_SHRINK_CONTROL_STRUCT
+ SPL_AC_RWSEM_SPINLOCK_IS_RAW
++ SPL_AC_SCHED_RT_HEADER
++ SPL_AC_2ARGS_VFS_GETATTR
+ ])
+
+ AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
+@@ -1684,12 +1687,55 @@ AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
+ [set_fs_pwd() wants 2 args])
++ HAVE_2ARGS_SET_FS_PWD=yes
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+ ])
+
+ dnl #
++dnl # 3.9 API change
++dnl # set_fs_pwd takes const struct path *
++dnl #
++AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
++if test "x$HAVE_2ARGS_SET_FS_PWD" = xyes; then
++ tmp_flags="$EXTRA_KCFLAGS"
++ EXTRA_KCFLAGS="-Werror"
++ [AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
++ SPL_LINUX_TRY_COMPILE([
++ #include <linux/spinlock.h>
++ #include <linux/fs_struct.h>
++ #include <linux/path.h>
++ void (*const set_fs_pwd_func)
++ (struct fs_struct *, const struct path *)
++ = set_fs_pwd;
++ ],[
++ return 0;
++ ],[
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_SET_FS_PWD_WITH_CONST, 1,
++ [set_fs_pwd() needs const path *])
++ ],[
++ SPL_LINUX_TRY_COMPILE([
++ #include <linux/spinlock.h>
++ #include <linux/fs_struct.h>
++ #include <linux/path.h>
++ void (*const set_fs_pwd_func)
++ (struct fs_struct *, struct path *)
++ = set_fs_pwd;
++ ],[
++ return 0;
++ ],[
++ AC_MSG_RESULT(no)
++ ],[
++ AC_MSG_ERROR(unknown)
++ ])
++ ])
++ EXTRA_KCFLAGS="$tmp_flags"
++fi
++])
++
++dnl #
+ dnl # SLES API change, never adopted in mainline,
+ dnl # Third 'struct vfsmount *' argument removed.
+ dnl #
+@@ -2217,3 +2263,53 @@ AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
+ ])
+ EXTRA_KCFLAGS="$tmp_flags"
+ ])
++
++dnl #
++dnl # 3.9 API change,
++dnl # Moved things from linux/sched.h to linux/sched/rt.h
++dnl #
++AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
++ [AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
++ SPL_LINUX_TRY_COMPILE([
++ #include <linux/sched.h>
++ #include <linux/sched/rt.h>
++ ],[
++ return 0;
++ ],[
++ AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists])
++ AC_MSG_RESULT(yes)
++ ],[
++ AC_MSG_RESULT(no)
++ ])
++])
++
++dnl #
++dnl # 3.9 API change,
++dnl # vfs_getattr() uses 2 args
++dnl # It takes struct path * instead of struct vfsmount * and struct dentry *
++dnl #
++AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
++ AC_MSG_CHECKING([whether vfs_getattr() wants])
++ SPL_LINUX_TRY_COMPILE([
++ #include <linux/fs.h>
++ ],[
++ vfs_getattr((struct path *) NULL,
++ (struct kstat *)NULL);
++ ],[
++ AC_MSG_RESULT(2 args)
++ AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
++ [vfs_getattr wants 2 args])
++ ],[
++ SPL_LINUX_TRY_COMPILE([
++ #include <linux/fs.h>
++ ],[
++ vfs_getattr((struct vfsmount *)NULL,
++ (struct dentry *)NULL,
++ (struct kstat *)NULL);
++ ],[
++ AC_MSG_RESULT(3 args)
++ ],[
++ AC_MSG_ERROR(unknown)
++ ])
++ ])
++])
+diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
+index 7c4da67..b4778b7 100644
+--- a/include/sys/sysmacros.h
++++ b/include/sys/sysmacros.h
+@@ -26,12 +26,17 @@
+ #define _SPL_SYSMACROS_H
+
+ #include <linux/module.h>
++#include <linux/sched.h>
+ #include <linux/cpumask.h>
+ #include <sys/debug.h>
+ #include <sys/varargs.h>
+ #include <sys/zone.h>
+ #include <sys/signal.h>
+
++#ifdef HAVE_SCHED_RT_HEADER
++#include <linux/sched/rt.h>
++#endif
++
+ #ifndef _KERNEL
+ #define _KERNEL __KERNEL__
+ #endif
+diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
+index e3538b5..f9c1114 100644
+--- a/module/spl/spl-kmem.c
++++ b/module/spl/spl-kmem.c
+@@ -404,7 +404,8 @@ kmem_del_init(spinlock_t *lock, struct hlist_head *table, int bits, const void *
+ spin_lock_irqsave(lock, flags);
+
+ head = &table[hash_ptr(addr, bits)];
+- hlist_for_each_entry_rcu(p, node, head, kd_hlist) {
++ hlist_for_each_rcu(node, head) {
++ p = list_entry_rcu(node, struct kmem_debug, kd_hlist);
+ if (p->kd_addr == addr) {
+ hlist_del_init(&p->kd_hlist);
+ list_del_init(&p->kd_list);
+diff --git a/module/spl/spl-tsd.c b/module/spl/spl-tsd.c
+index d7749cf..6e5605b 100644
+--- a/module/spl/spl-tsd.c
++++ b/module/spl/spl-tsd.c
+@@ -113,7 +113,8 @@ tsd_hash_search(tsd_hash_table_t *table, uint_t key, pid_t pid)
+ hash = hash_long((ulong_t)key * (ulong_t)pid, table->ht_bits);
+ bin = &table->ht_bins[hash];
+ spin_lock(&bin->hb_lock);
+- hlist_for_each_entry(entry, node, &bin->hb_head, he_list) {
++ hlist_for_each(node, &bin->hb_head) {
++ entry = list_entry(node, tsd_hash_entry_t, he_list);
+ if ((entry->he_key == key) && (entry->he_pid == pid)) {
+ spin_unlock(&bin->hb_lock);
+ SRETURN(entry);
+diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
+index 4d571c6..dac452c 100644
+--- a/module/spl/spl-vnode.c
++++ b/module/spl/spl-vnode.c
+@@ -175,7 +175,11 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode,
+ if (IS_ERR(fp))
+ SRETURN(-PTR_ERR(fp));
+
+- rc = vfs_getattr(fp->f_vfsmnt, fp->f_dentry, &stat);
++#ifdef HAVE_2ARGS_VFS_GETATTR
++ rc = vfs_getattr(&fp->f_path, &stat);
++#else
++ rc = vfs_getattr(fp->f_path.mnt, fp->f_dentry, &stat);
++#endif
+ if (rc) {
+ filp_close(fp, 0);
+ SRETURN(-rc);
+@@ -602,7 +606,11 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4)
+
+ fp = vp->v_file;
+
+- rc = vfs_getattr(fp->f_vfsmnt, fp->f_dentry, &stat);
++#ifdef HAVE_2ARGS_VFS_GETATTR
++ rc = vfs_getattr(&fp->f_path, &stat);
++#else
++ rc = vfs_getattr(fp->f_path.mnt, fp->f_dentry, &stat);
++#endif
+ if (rc)
+ SRETURN(-rc);
+
+@@ -754,7 +762,12 @@ vn_getf(int fd)
+ if (vp == NULL)
+ SGOTO(out_fget, rc);
+
+- if (vfs_getattr(lfp->f_vfsmnt, lfp->f_dentry, &stat))
++#ifdef HAVE_2ARGS_VFS_GETATTR
++ rc = vfs_getattr(&lfp->f_path, &stat);
++#else
++ rc = vfs_getattr(lfp->f_path.mnt, lfp->f_dentry, &stat);
++#endif
++ if (rc)
+ SGOTO(out_vnode, rc);
+
+ mutex_enter(&vp->v_lock);
+@@ -827,7 +840,11 @@ EXPORT_SYMBOL(releasef);
+ # ifdef HAVE_2ARGS_SET_FS_PWD
+ /* Used from 2.6.25 - 2.6.31+ */
+ void
++# ifdef HAVE_SET_FS_PWD_WITH_CONST
++set_fs_pwd(struct fs_struct *fs, const struct path *path)
++# else
+ set_fs_pwd(struct fs_struct *fs, struct path *path)
++# endif
+ {
+ struct path old_pwd;
+
diff --git a/sys-kernel/spl/files/spl-0.6.0_rc14-no-cond_resched.patch b/sys-kernel/spl/files/spl-0.6.0_rc14-no-cond_resched.patch
new file mode 100644
index 000000000000..9f1d692d0371
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.0_rc14-no-cond_resched.patch
@@ -0,0 +1,38 @@
+From 58a382c73ad3393d7591421950624e75d3c4aea1 Mon Sep 17 00:00:00 2001
+From: Richard Yao <ryao@cs.stonybrook.edu>
+Date: Thu, 21 Mar 2013 13:21:11 -0400
+Subject: [PATCH] Do not call cond_resched() in spl_slab_reclaim()
+
+Calling cond_resched() after each object is freed and then after each
+slab is freed can cause slabs of objects to live for excessive periods
+of time following reclaimation. This interferes with the kernel's own
+memory management when called from kswapd and can cause direct reclaim
+to occur in response to memory pressure that should have been resolved.
+
+Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
+---
+ module/spl/spl-kmem.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
+index f9c1114..a0ca2d2 100644
+--- a/module/spl/spl-kmem.c
++++ b/module/spl/spl-kmem.c
+@@ -1112,14 +1112,11 @@ char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap)
+
+ if (skc->skc_flags & KMC_OFFSLAB)
+ kv_free(skc, sko->sko_addr, size);
+-
+- cond_resched();
+ }
+
+ list_for_each_entry_safe(sks, m, &sks_list, sks_list) {
+ ASSERT(sks->sks_magic == SKS_MAGIC);
+ kv_free(skc, sks, skc->skc_slab_size);
+- cond_resched();
+ }
+
+ SEXIT;
+--
+1.8.1.5
+
diff --git a/sys-kernel/spl/files/spl-0.6.0_rc14-simplify-hostid-logic.patch b/sys-kernel/spl/files/spl-0.6.0_rc14-simplify-hostid-logic.patch
new file mode 100644
index 000000000000..3d5199fb4eb6
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.0_rc14-simplify-hostid-logic.patch
@@ -0,0 +1,181 @@
+From f47f028ae6f039c13d3138e2ee1c0056a3a3f789 Mon Sep 17 00:00:00 2001
+From: Richard Yao <ryao@cs.stonybrook.edu>
+Date: Mon, 11 Mar 2013 21:16:36 -0400
+Subject: [PATCH] Simplify hostid logic
+
+There is plenty of compatibility code for a hw_hostid
+that isn't used by anything. At the same time, there are apparently
+issues with the current hostid logic. coredumb in #zfsonlinux on
+freenode reported that Fedora 17 changes its hostid on every boot, which
+required force importing his pool. A suggestion by wca was to adopt
+FreeBSD's behavior, where it treats hostid as zero if /etc/hostid does
+not exist
+
+Adopting FreeBSD's behavior permits us to eliminate plenty of code,
+including a userland helper that invokes the system's hostid as a
+fallback.
+
+Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
+---
+ include/sys/sysmacros.h | 1 -
+ include/sys/systeminfo.h | 3 +--
+ module/spl/spl-generic.c | 55 ++++++------------------------------------------
+ module/spl/spl-proc.c | 11 ----------
+ 4 files changed, 7 insertions(+), 63 deletions(-)
+
+diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
+index 7c4da67..4dd2685 100644
+--- a/include/sys/sysmacros.h
++++ b/include/sys/sysmacros.h
+@@ -138,7 +138,6 @@
+ /* Missing globals */
+ extern char spl_version[32];
+ extern unsigned long spl_hostid;
+-extern char hw_serial[11];
+
+ /* Missing misc functions */
+ extern int highbit(unsigned long i);
+diff --git a/include/sys/systeminfo.h b/include/sys/systeminfo.h
+index e22a085..a4c1984 100644
+--- a/include/sys/systeminfo.h
++++ b/include/sys/systeminfo.h
+@@ -25,6 +25,5 @@
+ #ifndef _SPL_SYSTEMINFO_H
+ #define _SPL_SYSTEMINFO_H
+
+-#define HW_INVALID_HOSTID 0xFFFFFFFF /* an invalid hostid */
+ #define HW_HOSTID_LEN 11 /* minimum buffer size needed */
+ /* to hold a decimal or hex */
+diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c
+index 3cef489..b8e2ed1 100644
+--- a/module/spl/spl-generic.c
++++ b/module/spl/spl-generic.c
+@@ -52,14 +52,11 @@
+ char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE;
+ EXPORT_SYMBOL(spl_version);
+
+-unsigned long spl_hostid = HW_INVALID_HOSTID;
++unsigned long spl_hostid = 0;
+ EXPORT_SYMBOL(spl_hostid);
+ module_param(spl_hostid, ulong, 0644);
+ MODULE_PARM_DESC(spl_hostid, "The system hostid.");
+
+-char hw_serial[HW_HOSTID_LEN] = "<none>";
+-EXPORT_SYMBOL(hw_serial);
+-
+ proc_t p0 = { 0 };
+ EXPORT_SYMBOL(p0);
+
+@@ -467,7 +464,7 @@ struct new_utsname *__utsname(void)
+ int result;
+ uint64_t size;
+ struct _buf *file;
+- unsigned long hostid = 0;
++ uint32_t hostid = 0;
+
+ file = kobj_open_file(spl_hostid_path);
+
+@@ -511,45 +508,10 @@ struct new_utsname *__utsname(void)
+ return 0;
+ }
+
+-#define GET_HOSTID_CMD \
+- "exec 0</dev/null " \
+- " 1>/proc/sys/kernel/spl/hostid " \
+- " 2>/dev/null; " \
+- "hostid"
+-
+-static int
+-hostid_exec(void)
+-{
+- char *argv[] = { "/bin/sh",
+- "-c",
+- GET_HOSTID_CMD,
+- NULL };
+- char *envp[] = { "HOME=/",
+- "TERM=linux",
+- "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
+- NULL };
+- int rc;
+-
+- /* Doing address resolution in the kernel is tricky and just
+- * not a good idea in general. So to set the proper 'hw_serial'
+- * use the usermodehelper support to ask '/bin/sh' to run
+- * '/usr/bin/hostid' and redirect the result to /proc/sys/spl/hostid
+- * for us to use. It's a horrific solution but it will do for now.
+- */
+- rc = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
+- if (rc)
+- printk("SPL: Failed user helper '%s %s %s', rc = %d\n",
+- argv[0], argv[1], argv[2], rc);
+-
+- return rc;
+-}
+-
+ uint32_t
+ zone_get_hostid(void *zone)
+ {
+ static int first = 1;
+- unsigned long hostid;
+- int rc;
+
+ /* Only the global zone is supported */
+ ASSERT(zone == NULL);
+@@ -559,21 +521,16 @@ struct new_utsname *__utsname(void)
+
+ /*
+ * Get the hostid if it was not passed as a module parameter.
+- * Try reading the /etc/hostid file directly, and then fall
+- * back to calling the /usr/bin/hostid utility.
++ * Try reading the /etc/hostid file directly.
+ */
+- if ((spl_hostid == HW_INVALID_HOSTID) &&
+- (rc = hostid_read()) && (rc = hostid_exec()))
+- return HW_INVALID_HOSTID;
++ if (hostid_read())
++ spl_hostid = 0;
+
+ printk(KERN_NOTICE "SPL: using hostid 0x%08x\n",
+ (unsigned int) spl_hostid);
+ }
+
+- if (ddi_strtoul(hw_serial, NULL, HW_HOSTID_LEN-1, &hostid) != 0)
+- return HW_INVALID_HOSTID;
+-
+- return (uint32_t)hostid;
++ return spl_hostid;
+ }
+ EXPORT_SYMBOL(zone_get_hostid);
+
+diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c
+index cd4fa1b..1113cf2 100644
+--- a/module/spl/spl-proc.c
++++ b/module/spl/spl-proc.c
+@@ -506,9 +506,6 @@ enum {
+ if (str == end)
+ SRETURN(-EINVAL);
+
+- (void) snprintf(hw_serial, HW_HOSTID_LEN, "%lu", spl_hostid);
+- hw_serial[HW_HOSTID_LEN - 1] = '\0';
+- *ppos += *lenp;
+ } else {
+ len = snprintf(str, sizeof(str), "%lx", spl_hostid);
+ if (*ppos >= len)
+@@ -1051,14 +1048,6 @@ enum {
+ .mode = 0644,
+ .proc_handler = &proc_dohostid,
+ },
+- {
+- CTL_NAME (CTL_HW_SERIAL)
+- .procname = "hw_serial",
+- .data = hw_serial,
+- .maxlen = sizeof(hw_serial),
+- .mode = 0444,
+- .proc_handler = &proc_dostring,
+- },
+ #ifndef HAVE_KALLSYMS_LOOKUP_NAME
+ {
+ CTL_NAME (CTL_KALLSYMS)
+--
+1.8.1.5
+
diff --git a/sys-kernel/spl/files/spl-0.6.0_rc9-alias-km-sleep-with-km-pushpage.patch b/sys-kernel/spl/files/spl-0.6.0_rc9-alias-km-sleep-with-km-pushpage.patch
new file mode 100644
index 000000000000..fb0e5914e773
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.0_rc9-alias-km-sleep-with-km-pushpage.patch
@@ -0,0 +1,56 @@
+From 5c072b45b66e841ebc7952db7860c2ee7b024b08 Mon Sep 17 00:00:00 2001
+From: Richard Yao <ryao@cs.stonybrook.edu>
+Date: Mon, 25 Jun 2012 20:05:00 -0400
+Subject: [PATCH] Make KM_SLEEP an alias of KM_PUSHPAGE Use GFP_NOIO in
+ KM_SLEEP
+
+This should prevent direct reclaim issues without requiring
+Linux-specific changes to code from Solaris. This is what is done in
+FreeBSD.
+
+Note that a change to __taskq_dispatch() module/spl/spl-taskq.c is
+needed to make this work. Changing KM_PUSHPAGE to use GFP_NOIO is fine,
+but adding __GFP_HIGH to that triggers a hard-coded panic in
+__taskq_dispatch() during zvol initialization. Removing the hard coded
+panic has no ill effects.
+
+Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
+---
+ include/sys/kmem.h | 2 +-
+ module/spl/spl-taskq.c | 7 ++++---
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/include/sys/kmem.h b/include/sys/kmem.h
+index 796af44..633278b 100644
+--- a/include/sys/kmem.h
++++ b/include/sys/kmem.h
+@@ -41,7 +41,7 @@
+ /*
+ * Memory allocation interfaces
+ */
+-#define KM_SLEEP GFP_KERNEL /* Can sleep, never fails */
++#define KM_SLEEP (GFP_NOIO | __GFP_HIGH) /* Can sleep, never fails */
+ #define KM_NOSLEEP GFP_ATOMIC /* Can not sleep, may fail */
+ #define KM_PUSHPAGE (GFP_NOIO | __GFP_HIGH) /* Use reserved memory */
+ #define KM_NODEBUG __GFP_NOWARN /* Suppress warnings */
+diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c
+index 0c546c7..5ab387e 100644
+--- a/module/spl/spl-taskq.c
++++ b/module/spl/spl-taskq.c
+@@ -255,9 +255,10 @@
+ if (!(flags & (TQ_SLEEP | TQ_NOSLEEP)))
+ flags |= TQ_SLEEP;
+
+- if (unlikely(in_atomic() && (flags & TQ_SLEEP)))
+- PANIC("May schedule while atomic: %s/0x%08x/%d\n",
+- current->comm, preempt_count(), current->pid);
++ /* FIXME: Why does this fail when KM_SLEEP contains __GFP_HIGHMEM? */
++ //if (unlikely(in_atomic() && (flags & TQ_SLEEP)))
++ // PANIC("May schedule while atomic: %s/0x%08x/%d\n",
++ // current->comm, preempt_count(), current->pid);
+
+ spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags);
+
+--
+1.7.10
+
diff --git a/sys-kernel/spl/files/spl-0.6.1-builtin-fix.patch b/sys-kernel/spl/files/spl-0.6.1-builtin-fix.patch
new file mode 100644
index 000000000000..6be0c6d06ffe
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.1-builtin-fix.patch
@@ -0,0 +1,28 @@
+From 991857cac5929fa149820722b8e8cd90f874670c Mon Sep 17 00:00:00 2001
+From: Matthew Thode <mthode@mthode.org>
+Date: Fri, 21 Jun 2013 14:55:07 -0400
+Subject: [PATCH] Copy spl.release.in to kernel dir
+
+Required when compiling ZFS in the kernel.
+
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes #253
+---
+ copy-builtin | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/copy-builtin b/copy-builtin
+index 3277270..cd98b7a 100755
+--- a/copy-builtin
++++ b/copy-builtin
+@@ -33,6 +33,7 @@ rm -rf "$KERNEL_DIR/include/spl" "$KERNEL_DIR/spl"
+ cp --recursive include "$KERNEL_DIR/include/spl"
+ cp --recursive module "$KERNEL_DIR/spl"
+ cp spl_config.h "$KERNEL_DIR/"
++cp spl.release.in "$KERNEL_DIR/"
+
+ adjust_obj_paths()
+ {
+--
+1.8.1.6
+
diff --git a/sys-kernel/spl/files/spl-0.6.1-constify-ctl_table.patch b/sys-kernel/spl/files/spl-0.6.1-constify-ctl_table.patch
new file mode 100644
index 000000000000..e17cbad4ce81
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.1-constify-ctl_table.patch
@@ -0,0 +1,63 @@
+diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c
+index cd4fa1b..3cac8a1 100644
+--- a/module/spl/spl-proc.c
++++ b/module/spl/spl-proc.c
+@@ -37,6 +37,12 @@
+
+ #define SS_DEBUG_SUBSYS SS_PROC
+
++#ifdef CONSTIFY_PLUGIN
++typedef struct ctl_table __no_const spl_ctl_table;
++#else
++typedef struct ctl_table spl_ctl_table;
++#endif
++
+ #ifdef DEBUG_KMEM
+ static unsigned long table_min = 0;
+ static unsigned long table_max = ~0;
+@@ -323,7 +329,7 @@ enum {
+ SPL_PROC_HANDLER(proc_console_max_delay_cs)
+ {
+ int rc, max_delay_cs;
+- struct ctl_table dummy = *table;
++ spl_ctl_table dummy = *table;
+ long d;
+ SENTRY;
+
+@@ -355,7 +361,7 @@ enum {
+ SPL_PROC_HANDLER(proc_console_min_delay_cs)
+ {
+ int rc, min_delay_cs;
+- struct ctl_table dummy = *table;
++ spl_ctl_table dummy = *table;
+ long d;
+ SENTRY;
+
+@@ -387,7 +393,7 @@ enum {
+ SPL_PROC_HANDLER(proc_console_backoff)
+ {
+ int rc, backoff;
+- struct ctl_table dummy = *table;
++ spl_ctl_table dummy = *table;
+ SENTRY;
+
+ dummy.data = &backoff;
+@@ -417,7 +423,7 @@ enum {
+ {
+ int rc = 0;
+ unsigned long min = 0, max = ~0, val;
+- struct ctl_table dummy = *table;
++ spl_ctl_table dummy = *table;
+ SENTRY;
+
+ dummy.data = &val;
+@@ -444,7 +450,7 @@ enum {
+ {
+ int rc = 0;
+ unsigned long min = 0, max = ~0, val = 0, mask;
+- struct ctl_table dummy = *table;
++ spl_ctl_table dummy = *table;
+ spl_kmem_cache_t *skc;
+ SENTRY;
+
+--
diff --git a/sys-kernel/spl/files/spl-0.6.1-fix-delay.patch b/sys-kernel/spl/files/spl-0.6.1-fix-delay.patch
new file mode 100644
index 000000000000..42f1f59c7299
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.1-fix-delay.patch
@@ -0,0 +1,33 @@
+From ab59be7bc752481db64df07c821e2ae6bf2ae71b Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Date: Wed, 1 May 2013 16:20:28 -0700
+Subject: [PATCH] Fix delay()
+
+Somewhat amazingly it went unnoticed that the delay() function
+doesn't actually cause the task to block. Since the task state
+is never changed from TASK_RUNNING before schedule_timeout() the
+scheduler allows to task to continue running without any delay.
+Using schedule_timeout_interruptible() resolves the issue by
+correctly setting TASK_UNINTERRUPTIBLE.
+
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+---
+ include/sys/timer.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/sys/timer.h b/include/sys/timer.h
+index 13ef404..2542510 100644
+--- a/include/sys/timer.h
++++ b/include/sys/timer.h
+@@ -35,7 +35,7 @@
+ #define ddi_get_lbolt() ((clock_t)jiffies)
+ #define ddi_get_lbolt64() ((int64_t)get_jiffies_64())
+
+-#define delay(ticks) schedule_timeout((long)(ticks))
++#define delay(ticks) schedule_timeout_uninterruptible(ticks)
+
+ #define SEC_TO_TICK(sec) ((sec) * HZ)
+ #define MSEC_TO_TICK(ms) msecs_to_jiffies(ms)
+--
+1.8.1.6
+
diff --git a/sys-kernel/spl/files/spl-0.6.1-linux-3.10-compat.patch b/sys-kernel/spl/files/spl-0.6.1-linux-3.10-compat.patch
new file mode 100644
index 000000000000..aac1c926bbb4
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.1-linux-3.10-compat.patch
@@ -0,0 +1,426 @@
+diff --git a/config/spl-build.m4 b/config/spl-build.m4
+index 8a8e3ba..da179e3 100644
+--- a/config/spl-build.m4
++++ b/config/spl-build.m4
+@@ -33,6 +33,8 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
+ SPL_AC_TASK_CURR
+ SPL_AC_CTL_UNNUMBERED
+ SPL_AC_CTL_NAME
++ SPL_AC_VMALLOC_INFO
++ SPL_AC_PDE_DATA
+ SPL_AC_FLS64
+ SPL_AC_DEVICE_CREATE
+ SPL_AC_5ARGS_DEVICE_CREATE
+@@ -1358,6 +1360,43 @@ AC_DEFUN([SPL_AC_GET_VMALLOC_INFO],
+ ])
+
+ dnl #
++dnl # 3.10 API change,
++dnl # struct vmalloc_info is now declared in linux/vmalloc.h
++dnl #
++AC_DEFUN([SPL_AC_VMALLOC_INFO], [
++ AC_MSG_CHECKING([whether struct vmalloc_info is declared])
++ SPL_LINUX_TRY_COMPILE([
++ #include <linux/vmalloc.h>
++ struct vmalloc_info { void *a; };
++ ],[
++ return 0;
++ ],[
++ AC_MSG_RESULT(no)
++ ],[
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_VMALLOC_INFO, 1, [yes])
++ ])
++])
++
++dnl #
++dnl # 3.10 API change,
++dnl # PDE is replaced by PDE_DATA
++dnl #
++AC_DEFUN([SPL_AC_PDE_DATA], [
++ AC_MSG_CHECKING([whether PDE_DATA() is available])
++ SPL_LINUX_TRY_COMPILE_SYMBOL([
++ #include <linux/proc_fs.h>
++ ], [
++ PDE_DATA(NULL);
++ ], [PDE_DATA], [], [
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_PDE_DATA, 1, [yes])
++ ],[
++ AC_MSG_RESULT(no)
++ ])
++])
++
++dnl #
+ dnl # 2.6.17 API change
+ dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
+ dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
+diff --git a/include/linux/proc_compat.h b/include/linux/proc_compat.h
+index 434ffa3..7b044e7 100644
+--- a/include/linux/proc_compat.h
++++ b/include/linux/proc_compat.h
+@@ -43,9 +43,6 @@
+ #endif
+
+ extern struct proc_dir_entry *proc_spl_kstat;
+-struct proc_dir_entry *proc_dir_entry_find(struct proc_dir_entry *root,
+- const char *str);
+-int proc_dir_entries(struct proc_dir_entry *root);
+
+ int spl_proc_init(void);
+ void spl_proc_fini(void);
+diff --git a/include/sys/kstat.h b/include/sys/kstat.h
+index 9275c1e..da3c589 100644
+--- a/include/sys/kstat.h
++++ b/include/sys/kstat.h
+@@ -83,6 +83,13 @@ struct kstat_s;
+ typedef int kid_t; /* unique kstat id */
+ typedef int kstat_update_t(struct kstat_s *, int); /* dynamic update cb */
+
++typedef struct kstat_module {
++ char ksm_name[KSTAT_STRLEN+1]; /* module name */
++ struct list_head ksm_module_list; /* module linkage */
++ struct list_head ksm_kstat_list; /* list of kstat entries */
++ struct proc_dir_entry *ksm_proc; /* proc entry */
++} kstat_module_t;
++
+ typedef struct kstat_s {
+ int ks_magic; /* magic value */
+ kid_t ks_kid; /* unique kstat ID */
+@@ -102,6 +109,7 @@ typedef struct kstat_s {
+ void *ks_private; /* private data */
+ kmutex_t ks_lock; /* kstat data lock */
+ struct list_head ks_list; /* kstat linkage */
++ kstat_module_t *ks_owner; /* kstat module linkage */
+ } kstat_t;
+
+ typedef struct kstat_named_s {
+diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h
+index 9c52d28..34aea2b 100644
+--- a/include/sys/vmsystm.h
++++ b/include/sys/vmsystm.h
+@@ -74,10 +74,12 @@ extern size_t vmem_size(vmem_t *vmp, int typemask);
+ #ifndef HAVE_GET_VMALLOC_INFO
+ #ifdef CONFIG_MMU
+
++#ifndef HAVE_VMALLOC_INFO
+ struct vmalloc_info {
+ unsigned long used;
+ unsigned long largest_chunk;
+ };
++#endif
+
+ typedef void (*get_vmalloc_info_t)(struct vmalloc_info *);
+ extern get_vmalloc_info_t get_vmalloc_info_fn;
+diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
+index b7e4b94..4e900c0 100644
+--- a/module/spl/spl-kstat.c
++++ b/module/spl/spl-kstat.c
+@@ -33,9 +33,12 @@
+ #endif
+
+ #define SS_DEBUG_SUBSYS SS_KSTAT
++#ifndef HAVE_PDE_DATA
++#define PDE_DATA(x) (PDE(x)->data)
++#endif
+
+-static spinlock_t kstat_lock;
+-static struct list_head kstat_list;
++static kmutex_t kstat_module_lock;
++static struct list_head kstat_module_list;
+ static kid_t kstat_id;
+
+ static void
+@@ -348,6 +351,47 @@ static struct seq_operations kstat_seq_ops = {
+ .stop = kstat_seq_stop,
+ };
+
++static kstat_module_t *
++kstat_find_module(char *name)
++{
++ kstat_module_t *module;
++
++ list_for_each_entry(module, &kstat_module_list, ksm_module_list)
++ if (strncmp(name, module->ksm_name, KSTAT_STRLEN) == 0)
++ return (module);
++
++ return (NULL);
++}
++
++static kstat_module_t *
++kstat_create_module(char *name)
++{
++ kstat_module_t *module;
++ struct proc_dir_entry *pde;
++
++ pde = proc_mkdir(name, proc_spl_kstat);
++ if (pde == NULL)
++ return (NULL);
++
++ module = kmem_alloc(sizeof (kstat_module_t), KM_SLEEP);
++ module->ksm_proc = pde;
++ strlcpy(module->ksm_name, name, KSTAT_STRLEN+1);
++ INIT_LIST_HEAD(&module->ksm_kstat_list);
++ list_add_tail(&module->ksm_module_list, &kstat_module_list);
++
++ return (module);
++
++}
++
++static void
++kstat_delete_module(kstat_module_t *module)
++{
++ ASSERT(list_empty(&module->ksm_kstat_list));
++ remove_proc_entry(module->ksm_name, proc_spl_kstat);
++ list_del(&module->ksm_module_list);
++ kmem_free(module, sizeof(kstat_module_t));
++}
++
+ static int
+ proc_kstat_open(struct inode *inode, struct file *filp)
+ {
+@@ -359,7 +403,7 @@ proc_kstat_open(struct inode *inode, struct file *filp)
+ return rc;
+
+ f = filp->private_data;
+- f->private = PDE(inode)->data;
++ f->private = PDE_DATA(inode);
+
+ return rc;
+ }
+@@ -390,10 +434,10 @@ __kstat_create(const char *ks_module, int ks_instance, const char *ks_name,
+ if (ksp == NULL)
+ return ksp;
+
+- spin_lock(&kstat_lock);
++ mutex_enter(&kstat_module_lock);
+ ksp->ks_kid = kstat_id;
+ kstat_id++;
+- spin_unlock(&kstat_lock);
++ mutex_exit(&kstat_module_lock);
+
+ ksp->ks_magic = KS_MAGIC;
+ mutex_init(&ksp->ks_lock, NULL, MUTEX_DEFAULT, NULL);
+@@ -456,71 +500,64 @@ EXPORT_SYMBOL(__kstat_create);
+ void
+ __kstat_install(kstat_t *ksp)
+ {
+- struct proc_dir_entry *de_module, *de_name;
++ kstat_module_t *module;
+ kstat_t *tmp;
+- int rc = 0;
+- SENTRY;
+-
+- spin_lock(&kstat_lock);
+
+- /* Item may only be added to the list once */
+- list_for_each_entry(tmp, &kstat_list, ks_list) {
+- if (tmp == ksp) {
+- spin_unlock(&kstat_lock);
+- SGOTO(out, rc = -EEXIST);
+- }
+- }
++ ASSERT(ksp);
+
+- list_add_tail(&ksp->ks_list, &kstat_list);
+- spin_unlock(&kstat_lock);
++ mutex_enter(&kstat_module_lock);
+
+- de_module = proc_dir_entry_find(proc_spl_kstat, ksp->ks_module);
+- if (de_module == NULL) {
+- de_module = proc_mkdir(ksp->ks_module, proc_spl_kstat);
+- if (de_module == NULL)
+- SGOTO(out, rc = -EUNATCH);
++ module = kstat_find_module(ksp->ks_module);
++ if (module == NULL) {
++ module = kstat_create_module(ksp->ks_module);
++ if (module == NULL)
++ goto out;
+ }
+
+- de_name = create_proc_entry(ksp->ks_name, 0444, de_module);
+- if (de_name == NULL)
+- SGOTO(out, rc = -EUNATCH);
++ /*
++ * Only one entry by this name per-module, on failure the module
++ * shouldn't be deleted because we know it has at least one entry.
++ */
++ list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
++ if (strncmp(tmp->ks_name, ksp->ks_name, KSTAT_STRLEN) == 0)
++ goto out;
++
++ list_add_tail(&ksp->ks_list, &module->ksm_kstat_list);
+
+ mutex_enter(&ksp->ks_lock);
+- ksp->ks_proc = de_name;
+- de_name->proc_fops = &proc_kstat_operations;
+- de_name->data = (void *)ksp;
++ ksp->ks_owner = module;
++ ksp->ks_proc = proc_create_data(ksp->ks_name, 0444,
++ module->ksm_proc, &proc_kstat_operations, (void *)ksp);
++ if (ksp->ks_proc == NULL) {
++ list_del_init(&ksp->ks_list);
++ if (list_empty(&module->ksm_kstat_list))
++ kstat_delete_module(module);
++ }
+ mutex_exit(&ksp->ks_lock);
+ out:
+- if (rc) {
+- spin_lock(&kstat_lock);
+- list_del_init(&ksp->ks_list);
+- spin_unlock(&kstat_lock);
+- }
+-
+- SEXIT;
++ mutex_exit(&kstat_module_lock);
+ }
+ EXPORT_SYMBOL(__kstat_install);
+
+ void
+ __kstat_delete(kstat_t *ksp)
+ {
+- struct proc_dir_entry *de_module;
++ kstat_module_t *module = ksp->ks_owner;
+
+- spin_lock(&kstat_lock);
+- list_del_init(&ksp->ks_list);
+- spin_unlock(&kstat_lock);
++ mutex_enter(&kstat_module_lock);
++ list_del_init(&ksp->ks_list);
++ mutex_exit(&kstat_module_lock);
+
+- if (ksp->ks_proc) {
+- de_module = ksp->ks_proc->parent;
+- remove_proc_entry(ksp->ks_name, de_module);
++ if (ksp->ks_proc) {
++ remove_proc_entry(ksp->ks_name, module->ksm_proc);
+
+- /* Remove top level module directory if it's empty */
+- if (proc_dir_entries(de_module) == 0)
+- remove_proc_entry(de_module->name, de_module->parent);
++ /* Remove top level module directory if it's empty */
++ if (list_empty(&module->ksm_kstat_list))
++ kstat_delete_module(module);
+ }
+
+ if (!(ksp->ks_flags & KSTAT_FLAG_VIRTUAL))
+- kmem_free(ksp->ks_data, ksp->ks_data_size);
++ kmem_free(ksp->ks_data, ksp->ks_data_size);
+
+ mutex_destroy(&ksp->ks_lock);
+ kmem_free(ksp, sizeof(*ksp));
+@@ -533,8 +570,8 @@ int
+ spl_kstat_init(void)
+ {
+ SENTRY;
+- spin_lock_init(&kstat_lock);
+- INIT_LIST_HEAD(&kstat_list);
++ mutex_init(&kstat_module_lock, NULL, MUTEX_DEFAULT, NULL);
++ INIT_LIST_HEAD(&kstat_module_list);
+ kstat_id = 0;
+ SRETURN(0);
+ }
+@@ -543,7 +580,8 @@ void
+ spl_kstat_fini(void)
+ {
+ SENTRY;
+- ASSERT(list_empty(&kstat_list));
++ ASSERT(list_empty(&kstat_module_list));
++ mutex_destroy(&kstat_module_lock);
+ SEXIT;
+ }
+
+diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c
+index cd4fa1b..b8379d0 100644
+--- a/module/spl/spl-proc.c
++++ b/module/spl/spl-proc.c
+@@ -1120,39 +1120,6 @@ static struct ctl_table spl_root[] = {
+ { 0 }
+ };
+
+-static int
+-proc_dir_entry_match(int len, const char *name, struct proc_dir_entry *de)
+-{
+- if (de->namelen != len)
+- return 0;
+-
+- return !memcmp(name, de->name, len);
+-}
+-
+-struct proc_dir_entry *
+-proc_dir_entry_find(struct proc_dir_entry *root, const char *str)
+-{
+- struct proc_dir_entry *de;
+-
+- for (de = root->subdir; de; de = de->next)
+- if (proc_dir_entry_match(strlen(str), str, de))
+- return de;
+-
+- return NULL;
+-}
+-
+-int
+-proc_dir_entries(struct proc_dir_entry *root)
+-{
+- struct proc_dir_entry *de;
+- int i = 0;
+-
+- for (de = root->subdir; de; de = de->next)
+- i++;
+-
+- return i;
+-}
+-
+ int
+ spl_proc_init(void)
+ {
+@@ -1174,11 +1141,11 @@ spl_proc_init(void)
+ if (proc_spl_kmem == NULL)
+ SGOTO(out, rc = -EUNATCH);
+
+- proc_spl_kmem_slab = create_proc_entry("slab", 0444, proc_spl_kmem);
++ proc_spl_kmem_slab = proc_create_data("slab", 0444,
++ proc_spl_kmem, &proc_slab_operations, NULL);
+ if (proc_spl_kmem_slab == NULL)
+ SGOTO(out, rc = -EUNATCH);
+
+- proc_spl_kmem_slab->proc_fops = &proc_slab_operations;
+ #endif /* DEBUG_KMEM */
+
+ proc_spl_kstat = proc_mkdir("kstat", proc_spl);
+diff --git a/module/splat/splat-atomic.c b/module/splat/splat-atomic.c
+index df3b38f..f702196 100644
+--- a/module/splat/splat-atomic.c
++++ b/module/splat/splat-atomic.c
+@@ -26,6 +26,7 @@
+
+ #include <sys/atomic.h>
+ #include <sys/thread.h>
++#include <linux/slab.h>
+ #include "splat-internal.h"
+
+ #define SPLAT_ATOMIC_NAME "atomic"
+diff --git a/module/splat/splat-thread.c b/module/splat/splat-thread.c
+index a1e70db..e55acd0 100644
+--- a/module/splat/splat-thread.c
++++ b/module/splat/splat-thread.c
+@@ -26,6 +26,7 @@
+
+ #include <sys/thread.h>
+ #include <sys/random.h>
++#include <linux/slab.h>
+ #include "splat-internal.h"
+
+ #define SPLAT_THREAD_NAME "thread"
+diff --git a/module/splat/splat-time.c b/module/splat/splat-time.c
+index ca60c45..cd513c9 100644
+--- a/module/splat/splat-time.c
++++ b/module/splat/splat-time.c
+@@ -25,6 +25,7 @@
+ \*****************************************************************************/
+
+ #include <sys/time.h>
++#include <linux/slab.h>
+ #include "splat-internal.h"
+
+ #define SPLAT_TIME_NAME "time"
diff --git a/sys-kernel/spl/metadata.xml b/sys-kernel/spl/metadata.xml
new file mode 100644
index 000000000000..a446f2c2fe48
--- /dev/null
+++ b/sys-kernel/spl/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>ryao@gentoo.org</email>
+ <name>Richard Yao</name>
+ </maintainer>
+ <use>
+ <flag name="debug-log">Enable additional diagnostics</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">zfsonlinux/spl</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-kernel/spl/spl-0.6.0_rc13-r2.ebuild b/sys-kernel/spl/spl-0.6.0_rc13-r2.ebuild
new file mode 100644
index 000000000000..f96a7db4be38
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.0_rc13-r2.ebuild
@@ -0,0 +1,114 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 8 || die "Linux 3.8 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ # Fix on_each_cpu autotools to work correctly
+ epatch "${FILESDIR}/${P}-fix-on_each_cpu-autotools-check.patch"
+
+ # Fix soft lockup regression
+ epatch "${FILESDIR}/${P}-fix-soft-lockup.patch"
+
+ # Fix x86 build failures on Linux 3.4 and later, bug #450646
+ epatch "${FILESDIR}/${PN}-0.6.0_rc14-fix-atomic64-checks.patch"
+
+ # Fix autotools check that fails on ~ppc64
+ epatch "${FILESDIR}/${PN}-0.6.0_rc14-fix-mutex-owner-check.patch"
+ fi
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_test() {
+ if [[ ! -e /proc/modules ]]
+ then
+ die "Missing /proc/modules"
+ elif [[ $UID -ne 0 ]]
+ then
+ ewarn "Cannot run make check tests with FEATURES=userpriv."
+ ewarn "Skipping make check tests."
+ elif grep -q '^spl ' /proc/modules
+ then
+ ewarn "Cannot run make check tests with module spl loaded."
+ ewarn "Skipping make check tests."
+ else
+ autotools-utils_src_test
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.0_rc14-r3.ebuild b/sys-kernel/spl/spl-0.6.0_rc14-r3.ebuild
new file mode 100644
index 000000000000..94f8fd85f95c
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.0_rc14-r3.ebuild
@@ -0,0 +1,125 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 9 || die "Linux 3.9 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ # Fix x86 build failures on Linux 3.4 and later, bug #450646
+ epatch "${FILESDIR}/${P}-fix-atomic64-checks.patch"
+
+ # Fix autotools check that fails on ~ppc64
+ epatch "${FILESDIR}/${P}-fix-mutex-owner-check.patch"
+
+ # Linux 3.9 Support
+ epatch "${FILESDIR}/${P}-linux-3.9-compat.patch"
+
+ # Free memory under load quickly
+ epatch "${FILESDIR}/${P}-no-cond_resched.patch"
+ fi
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ dodoc AUTHORS DISCLAIMER README.markdown
+
+ # Provide /usr/src/spl symlink for lustre
+ dosym "$(basename $(echo "${ED}/usr/src/spl-"*))/${KV_FULL}" /usr/src/spl
+}
+
+src_test() {
+ if [[ ! -e /proc/modules ]]
+ then
+ die "Missing /proc/modules"
+ elif [[ $UID -ne 0 ]]
+ then
+ ewarn "Cannot run make check tests with FEATURES=userpriv."
+ ewarn "Skipping make check tests."
+ elif grep -q '^spl ' /proc/modules
+ then
+ ewarn "Cannot run make check tests with module spl loaded."
+ ewarn "Skipping make check tests."
+ else
+ autotools-utils_src_test
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.1-r3.ebuild b/sys-kernel/spl/spl-0.6.1-r3.ebuild
new file mode 100644
index 000000000000..d4866ac9cb4c
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.1-r3.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !UIDGID_STRICT_TYPE_CHECKS
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 10 || die "Linux 3.10 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ # Be more like FreeBSD and Illumos when handling hostids
+ epatch "${FILESDIR}/${PN}-0.6.0_rc14-simplify-hostid-logic.patch"
+
+ # Block tasks properly
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-delay.patch"
+
+ # Linux 3.10 Compatibility
+ epatch "${FILESDIR}/${PN}-0.6.1-linux-3.10-compat.patch"
+
+ # Fix kernel builtin support
+ epatch "${FILESDIR}/${PN}-0.6.1-builtin-fix.patch"
+
+ # Support recent hardened kernels
+ if kernel_is ge 3 8
+ then
+ epatch "${FILESDIR}/${PN}-0.6.1-constify-ctl_table.patch"
+ fi
+ fi
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.2-r1.ebuild b/sys-kernel/spl/spl-0.6.2-r1.ebuild
new file mode 100644
index 000000000000..a3de4381f9e4
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.2-r1.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz
+ http://dev.gentoo.org/~ryao/dist/${PN}-${MY_PV}-p0.tar.xz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 11 || die "Linux 3.11 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ # Apply patch set
+ EPATCH_SUFFIX="patch" \
+ EPATCH_FORCE="yes" \
+ epatch "${WORKDIR}/${PN}-${MY_PV}-patches"
+ fi
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.2-r2.ebuild b/sys-kernel/spl/spl-0.6.2-r2.ebuild
new file mode 100644
index 000000000000..46ecb6d0e97e
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.2-r2.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz
+ http://dev.gentoo.org/~ryao/dist/${PN}-${MY_PV}-p1.tar.xz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 12 || die "Linux 3.12 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ # Apply patch set
+ EPATCH_SUFFIX="patch" \
+ EPATCH_FORCE="yes" \
+ epatch "${WORKDIR}/${PN}-${MY_PV}-patches"
+ fi
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.2-r3.ebuild b/sys-kernel/spl/spl-0.6.2-r3.ebuild
new file mode 100644
index 000000000000..046f84a4e966
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.2-r3.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz
+ http://dev.gentoo.org/~ryao/dist/${PN}-${MY_PV}-p2.tar.xz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 13 || die "Linux 3.13 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ # Apply patch set
+ EPATCH_SUFFIX="patch" \
+ EPATCH_FORCE="yes" \
+ epatch "${WORKDIR}/${PN}-${MY_PV}-patches"
+ fi
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.2-r4.ebuild b/sys-kernel/spl/spl-0.6.2-r4.ebuild
new file mode 100644
index 000000000000..26d1b543edf7
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.2-r4.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz
+ http://dev.gentoo.org/~ryao/dist/${PN}-${MY_PV}-p3.tar.xz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 14 || die "Linux 3.14 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ # Apply patch set
+ EPATCH_SUFFIX="patch" \
+ EPATCH_FORCE="yes" \
+ epatch "${WORKDIR}/${PN}-${MY_PV}-patches"
+ fi
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.2-r5.ebuild b/sys-kernel/spl/spl-0.6.2-r5.ebuild
new file mode 100644
index 000000000000..44b21c345c92
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.2-r5.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz
+ http://dev.gentoo.org/~ryao/dist/${PN}-${MY_PV}-p4.tar.xz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 14 || die "Linux 3.14 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ # Apply patch set
+ EPATCH_SUFFIX="patch" \
+ EPATCH_FORCE="yes" \
+ epatch "${WORKDIR}/${PN}-${MY_PV}-patches"
+ fi
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.2.ebuild b/sys-kernel/spl/spl-0.6.2.ebuild
new file mode 100644
index 000000000000..d85a170a3a94
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.2.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 11 || die "Linux 3.11 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ # Be more like FreeBSD and Illumos when handling hostids
+ epatch "${FILESDIR}/${PN}-0.6.0_rc14-simplify-hostid-logic.patch"
+ fi
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.3-r1.ebuild b/sys-kernel/spl/spl-0.6.3-r1.ebuild
new file mode 100644
index 000000000000..8cb54070e141
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.3-r1.ebuild
@@ -0,0 +1,125 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${P}.tar.gz
+ http://dev.gentoo.org/~ryao/dist/${P}-patches-${PR}.tar.xz"
+ S="${WORKDIR}/${PN}-${P}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="debug? ( strip ) test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !PAX_SIZE_OVERFLOW
+ !PAX_RANDKSTACK
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ use debug && CONFIG_CHECK="${CONFIG_CHECK}
+ FRAME_POINTER
+ DEBUG_INFO
+ !DEBUG_INFO_REDUCED
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 17 || die "Linux 3.17 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" "${S}/scripts/check.sh" || \
+ die "Cannot patch check.sh"
+
+ if [ ${PV} != "9999" ]
+ then
+ # Apply patch set
+ EPATCH_SUFFIX="patch" \
+ EPATCH_FORCE="yes" \
+ epatch "${WORKDIR}/${P}-patches"
+ fi
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ # Set module revision number
+ [ ${PV} != "9999" ] && \
+ { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.3.ebuild b/sys-kernel/spl/spl-0.6.3.ebuild
new file mode 100644
index 000000000000..03171e038b67
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.3.ebuild
@@ -0,0 +1,117 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="debug? ( strip ) test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !PAX_SIZE_OVERFLOW
+ !PAX_RANDKSTACK
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ use debug && CONFIG_CHECK="${CONFIG_CHECK}
+ FRAME_POINTER
+ DEBUG_INFO
+ !DEBUG_INFO_REDUCED
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 16 || die "Linux 3.16 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" "${S}/scripts/check.sh" || \
+ die "Cannot patch check.sh"
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ # Set module revision number
+ [ ${PV} != "9999" ] && \
+ { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.4.2.ebuild b/sys-kernel/spl/spl-0.6.4.2.ebuild
new file mode 100644
index 000000000000..73ad7a942c1e
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.4.2.ebuild
@@ -0,0 +1,114 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${P}.tar.gz"
+ S="${WORKDIR}/${PN}-${P}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="debug? ( strip ) test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !PAX_SIZE_OVERFLOW
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ use debug && CONFIG_CHECK="${CONFIG_CHECK}
+ FRAME_POINTER
+ DEBUG_INFO
+ !DEBUG_INFO_REDUCED
+ "
+
+ kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 4 1 || die "Linux 4.1 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" "${S}/scripts/check.sh" || \
+ die "Cannot patch check.sh"
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ # Set module revision number
+ [ ${PV} != "9999" ] && \
+ { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-0.6.4.ebuild b/sys-kernel/spl/spl-0.6.4.ebuild
new file mode 100644
index 000000000000..3799c7219c70
--- /dev/null
+++ b/sys-kernel/spl/spl-0.6.4.ebuild
@@ -0,0 +1,114 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${P}.tar.gz"
+ S="${WORKDIR}/${PN}-${P}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="debug? ( strip ) test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !PAX_SIZE_OVERFLOW
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ use debug && CONFIG_CHECK="${CONFIG_CHECK}
+ FRAME_POINTER
+ DEBUG_INFO
+ !DEBUG_INFO_REDUCED
+ "
+
+ kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 4 20 || die "Linux 4.0 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" "${S}/scripts/check.sh" || \
+ die "Cannot patch check.sh"
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ # Set module revision number
+ [ ${PV} != "9999" ] && \
+ { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}
diff --git a/sys-kernel/spl/spl-9999.ebuild b/sys-kernel/spl/spl-9999.ebuild
new file mode 100644
index 000000000000..03171e038b67
--- /dev/null
+++ b/sys-kernel/spl/spl-9999.ebuild
@@ -0,0 +1,117 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+AUTOTOOLS_AUTORECONF="1"
+
+inherit flag-o-matic linux-info linux-mod autotools-utils
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2
+ EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
+fi
+
+DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="custom-cflags debug debug-log"
+RESTRICT="debug? ( strip ) test"
+
+COMMON_DEPEND="dev-lang/perl
+ virtual/awk"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-devel/spl"
+
+AT_M4DIR="config"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ !GRKERNSEC_HIDESYM
+ MODULES
+ KALLSYMS
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !PAX_SIZE_OVERFLOW
+ !PAX_RANDKSTACK
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ use debug && CONFIG_CHECK="${CONFIG_CHECK}
+ FRAME_POINTER
+ DEBUG_INFO
+ !DEBUG_INFO_REDUCED
+ "
+
+ kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 16 || die "Linux 3.16 is the latest supported version."; }
+
+ check_extra_config
+}
+
+src_prepare() {
+ # Workaround for hard coded path
+ sed -i "s|/sbin/lsmod|/bin/lsmod|" "${S}/scripts/check.sh" || \
+ die "Cannot patch check.sh"
+
+ # splat is unnecessary unless we are debugging
+ use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
+
+ # Set module revision number
+ [ ${PV} != "9999" ] && \
+ { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ set_arch_to_kernel
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=all
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ $(use_enable debug-log)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
+ dodoc AUTHORS DISCLAIMER README.markdown
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
+ then
+ ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
+ ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
+ fi
+}