summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 3537 add kstat_waitq_enter and friendsNed Bass2013-10-252-1/+71
| | | | | | | | | | | | | | | These kstat interfaces are required to port "Illumos #3537 want pool io kstats" to ZFS on Linux. kstat_waitq_enter() kstat_waitq_exit() kstat_runq_enter() kstat_runq_exit() Additionally, zero out the ks_data buffer in __kstat_create() so that the kstat_io_t counters are initialized to zero. Signed-off-by: Brian Behlendorf <[email protected]>
* Kstat to use private lock by defaultCyril Plisko2013-10-252-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | While porting Illumos #3537 I found that ks_lock member of kstat_t structure is different between Illumos and SPL. It is a pointer to the kmutex_t in Illumos, but the mutex lock itself in SPL. Apparently Illumos kstat API allows consumer to override the lock if required. With SPL implementation it is not possible anymore. Things were alright until the first attempt to actually override the lock. Porting of Illumos #3537 introduced such code for the first time. In order to provide the Solaris/Illumos like functionality we: 1. convert ks_lock to "kmutex_t *ks_lock" 2. create a new field "kmutex_t ks_private_lock" 3. On kstat_create() ks_lock = &ks_private_lock Thus if consumer doesn't care we still have our internal lock in use. If, however, consumer does care she has a chance to set ks_lock to anything else before calling kstat_install(). The rest of the code will use ks_lock regardless of its origin. Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #286
* Revert "Add KSTAT_TYPE_TXG type"Brian Behlendorf2013-10-162-61/+1
| | | | | | | | | | This reverts commit dba79fcbf2cc50be5caef84ae01657e884ac5d89 in favor of using the generic KSTAT_TYPE_RAW callbacks. The advantage of this approach is that arbitrary types can be added without the need to add them to the SPL. Signed-off-by: Brian Behlendorf <[email protected]> Issue #296
* Add wrappers for accessing PID and command infoPrakash Surya2013-10-161-0/+2
| | | | | | | | | This change adds simple wrappers for accessing a thread's PID and command character string. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #296
* Add callbacks for displaying KSTAT_TYPE_RAW kstatsPrakash Surya2013-10-162-16/+123
| | | | | | | | | | | | | | | | | | | The current implementation for displaying kstats of type KSTAT_TYPE_RAW is rather crude. This patch attempts to enhance this handling by allowing a kstat user to register formatting callbacks which can optionally be used. The callbacks allow the user to implement functions for interpreting their data and transposing it into a character buffer. This buffer, containing a string representation of the raw data, is then be displayed through the current /proc textual interface. Additionally the kstats are made writable because it's now possible to provide a useful handler via the existing ks_update() interface. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #296
* Define SET_ERROR()Richard Yao2013-10-091-0/+2
| | | | | Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Consistently use local_irq_disable/local_irq_enableBrian Behlendorf2013-10-091-3/+2
| | | | | | | | | | | | | | | | | | It was observed that spl_kmem_cache_alloc() uses local_irq_save() and saves the interrupt state in a local variable. This would normally be fine except that spl_kmem_cache_alloc() calls spl_cache_refill() which re-enables interrupts. It is then possible that while interrupts are enabled the process is rescheduled to a different cpu before being disable again. This could result in us restoring the saved interrupt state from one cpu to another. What the consequences of this are aren't perfectly clear, but this is clearly a bug and it has the potential to cause issues. The code has been updated to just use local_irq_enable() and local_irq_disable() to avoid this. Signed-off-by: Brian Behlendorf <[email protected]>
* Document how to run SPLATKohsuke Kawaguchi2013-10-091-2/+10
| | | | | Signed-off-by: Brian Behlendorf <[email protected]> Closes #294
* Add kpreempt() compatibility macroNed Bass2013-10-091-0/+1
| | | | | | | | | This is needed for the Illumos #4045 write throttle patch. It is used in the arc eviction code to avoid blocking all arc activity by sitting on arcs_mtx too long. Signed-off-by: Brian Behlendorf <[email protected]> Issue #286
* Replace current_kernel_time() with getnstimeofday()Richard Yao2013-10-092-6/+9
| | | | | | | | | | | current_kernel_time() is used by the SPLAT, but it is not meant for performance measurement. We modify the SPLAT to use getnstimeofday(), which is equivalent to the gethrestime() function on Solaris. Additionally, we update gethrestime() to invoke getnstimeofday(). Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #279
* Tag spl-0.6.2Brian Behlendorf2013-08-164-1/+7
| | | | | | META file and release log updated. Signed-off-by: Brian Behlendorf <[email protected]>
* Linux 3.8 compat: Use kuid_t/kgid_t when requiredRichard Yao2013-08-094-14/+87
| | | | | | | | | | | | | | | | | When CONFIG_UIDGID_STRICT_TYPE_CHECKS is enabled uid_t/git_t are replaced by kuid_t/kgid_t, which are structures instead of integral types. This causes any code that uses an integral type to fail to build. The User Namespace functionality introduced in Linux 3.8 requires CONFIG_UIDGID_STRICT_TYPE_CHECKS, so we could not build against any kernel that supported it. We resolve this by converting between the new kuid_t/kgid_t structures and the original uid_t/gid_t types. Original-patch-by: DHE Rewrite-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #260
* PaX/GrSecurity Linux 3.8.y compat: Use __no_const on struct ctl_tableRichard Yao2013-08-081-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PaX team started constifying `struct ctl_table` as of their Linux 3.8.0 patchset. This lead to zfsonlinux/spl#225 and Gentoo bug #463012. While investigating our options, I learned that there is a preprocessor directive called CONSTIFY_PLUGIN that we can use to detect the presence of the PaX changes and adjust the code accordingly. The PaX Team had suggested adopting ctl_table_no_const, but supporting older kernels required declaring that whenever the CONSTIFY_PLUGIN was set. Future compiler changes could potentially cause that to break in the presence of -Werror, so instead we define our own spl_ctl_table typdef and use that. This should be compatible with all PaX kernels. This introduces a Linux kernel version number check to prevent a build failure on versions of the PaX GCC plugin that existed for kernels before Linux 3.8.0. Affected versions of the PaX plugin will trigger a compiler error when they see no_const cast on a non-constified structure. Ordinarily, we would need an autotools check to catch that. However, it is safe to do a kernel version check instead of an autotools check in this specific instance because the affected versions of the PaX GCC plugin only exist for Linux kernels before 3.8.0 and the constification of `struct ctl_table` by the PaX developers only occurs in Linux 3.8.0 and later. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #225
* Fix race in spl_kmem_cache_reap_now()Richard Yao2013-08-081-5/+5
| | | | | | | | | | | | | | | | | | | | The current code contains a race condition that triggers when bit 2 in spl.spl_kmem_cache_expire is set, spl_kmem_cache_reap_now() is invoked and another thread is concurrently accessing its magazine. spl_kmem_cache_reap_now() currently invokes spl_cache_flush() on each magazine in the same thread when bit 2 in spl.spl_kmem_cache_expire is set. This is unsafe because there is one magazine per CPU and the magazines are lockless, so it is impossible to guarentee that another CPU is not using its magazine when this function is called. The solution is to only touch the local CPU's magazine and leave other CPU's magazines to other CPUs. Reported-by: DHE Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #274
* Linux 3.11 compat: Replace num_physpages with totalram_pagesRichard Yao2013-08-082-3/+4
| | | | | | | | | | | | | | | | | | | | num_physpages was removed by torvalds/linux@cfa11e08ed39eb28a9eff9a907b20913020c69b5, so lets replace it with totalram_pages. This is a bug fix as much as it is a compatibility fix because num_physpages did not reflect the number of pages actually available to the kernel: http://lkml.indiana.edu/hypermail/linux/kernel/0908.2/01001.html Also, there are known issues with memory calculations when ZFS is in a Xen dom0. There is a chance that using totalram_pages could resolve them. This conjecture is untested at the time of writing. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #273
* Add kmod repo integrationBrian Behlendorf2013-08-013-162/+74
| | | | | | | | | | | | | | | | | | When the kmod packaging infrastructure was originally added the dependency on the rpmfusion yum repositories was disabled. This was done at the time in favour of getting local builds working. Now the time has come to conditionally re-enable that functionality so we can properly provide binary kmod packages. ./configure --with-config=srpm make SRPM_DEFINE_KMOD='--define="repo rpmfusion"' srpm-kmod mock rebuild spl-kmod-x.y.z-r.el6.src.rpm One nice benefit of finishing this work is that the generic and fedora spl-kmod spec files can be merged again. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix KMC_OFFSLAB type cachesBrian Behlendorf2013-07-302-3/+45
| | | | | | | | | | | | | | | Because spl_slab_size() was always returning -ENOSPC for caches of type KMC_OFFSLAB the cache could never be created. Additionally the slab size is rounded up to a page which is what kv_alloc() expects. The kv_alloc() code will minimally allocate a page, in the KMC_OFFSLAB case this could be reduced. The basic regression tests kmem:slab_small, kmem:slab_large, and kmem:slab_align regression were updated to test KMC_OFFSLAB. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Ying Zhu <[email protected]> Closes #266
* Return -1 for generic kmem cache shrinkerBrian Behlendorf2013-07-301-1/+9
| | | | | | | | | | | | | | | It has been observed that it's possible to get in a state where shrink_slabs() will spin repeated invoking the generic kmem cache shrinker. It fails to detect it's not making forward progress reclaiming from the cache and doesn't give up. To ensure this never occurs we unconditionally return -1 after reclaiming what we can. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes zfsonlinux/zfs#1276 Closes zfsonlinux/zfs#1598 Closes zfsonlinux/zfs#1432
* Modify gethrestime to use current_kernel_time()James H2013-07-151-4/+3
| | | | | | | | | This allows us to get nanosecond resolution. It also means we use the same time source as utimensat(now) etc. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #255
* Improve build instructionsBrian Behlendorf2013-07-111-1/+6
| | | | | | | | | | Make it clear that when building directly from the Git tree the configure script must be manually generated by running the autogen.sh script. This requires that the GNU autotools packages be installed for your distribution. Signed-off-by: Brian Behlendorf <[email protected]> Closes zfsonlinux/zfs#1448
* Fix bogus kmem leak warningBrian Behlendorf2013-07-101-4/+5
| | | | | | | | | | | | Commit 5c7a036 correctly relocated the creation of a taskq and the registraction of the kmem_cache_shrinker after the initialization of the kmem tracking code. However, the cleanup of these structures was not done before the leak checks in spl_kmem_fini(). This resulted in an incorrect 'kmem leaked' warning even though there was no actual leak. Signed-off-by: Brian Behlendorf <[email protected]> Closes zfsonlinux/zfs#1569
* Fix --enable-debug-kmem-tracking optionBrian Behlendorf2013-07-091-9/+9
| | | | | | | | | | | | | | | | | | | This code has gotten something stale and no longer builds cleanly against modern kernels. The two issues addressed here are as follows: * The hlist_*_rcu interfaces in the kernel have been relatively unstable. Since this isn't performance critical code just use the long standing hlist_* variants. * In older kernels the hash_ptr() function takes a 'void *' but in newer kernels it expects a 'const void *'. To silence the compiler warnings about this explicitly cast it to a 'void *'. The memset function is a similar case but it always expects a 'void *'. Signed-off-by: Brian Behlendorf <[email protected]> Closes #256
* Merge branch 'linux-3.10'Brian Behlendorf2013-07-089-89/+143
|\ | | | | | | | | Signed-off-by: Brian Behlendorf <[email protected]> Closes #257
| * Linux 3.10 compat: Do not rely on struct proc_dir_entry definitionRichard Yao2013-07-084-88/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux kernel commit torvalds/linux#59d8053f moved the definition of struct proc_dir_entry from include/linux/proc_fs.h to the private header fs/proc/internal.h. The SPL relied on that to map Solaris' kstat to entries in /proc/spl/kstat. Since the proc_dir_entry structure is now private the only safe thing to do is wrap the opaque proc handle with our own structure. This actually ends up simplify the code and is good because it moves us away from depending on implementation details of /proc. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #257
| * Linux 3.10 compat: add missing include of linux/slab.hYuxuan Shui2013-07-083-0/+3
| | | | | | | | | | | | | | | | | | Linux kernel commit torvalds/linux@0d01ff2 changes some includes we were depending on through linux/proc_fs.h. Signed-off-by: Yuxuan Shui <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #257
| * Linux 3.10 compat: replace PDE()->data with PDE_DATA()Yuxuan Shui2013-07-082-1/+23
| | | | | | | | | | | | | | | | | | | | | | Linux kernel commit torvalds/linux@d9dda78b renamed PDE() to PDE_DATA(). To handle this detect the prefered interface and define a PDE_DATA() wrapper for consistency. Signed-off-by: Yuxuan Shui <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #257
| * Linux 3.10 compat: struct vmalloc_info movedYuxuan Shui2013-07-082-0/+22
|/ | | | | | | | | | Linux kernel commmit torvalds/linux@db3808c1 moved the vmalloc_info structure from a private to a public header. Now that it's available for kernel modules use it. Signed-off-by: Yuxuan Shui <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #257
* Add --buildroot option to kmod buildNathaniel Clark2013-06-213-7/+13
| | | | | | | | This allows rpmbuild to define buildroot to point to where kernel data is located. Signed-off-by: Brian Behlendorf <[email protected]> Closes #242
* Copy spl.release.in to kernel dirMatthew Thode2013-06-211-0/+1
| | | | | | | Required when compiling ZFS in the kernel. Signed-off-by: Brian Behlendorf <[email protected]> Closes #253
* Fix ASSERT0 and VERIFY0 macro typoBrian Behlendorf2013-06-211-2/+2
| | | | | | | | | Ensure the value is cast to a 'long long' for printing purposes. The expectation is that ASSERT0/VERIFY0 are mostly used for validating return values and thus may commonly be negative. Signed-off-by: Brian Behlendorf <[email protected]> Issue #246
* Add ASSERT0 and VERIFY0 macrosBrian Behlendorf2013-06-181-0/+6
| | | | | | | | | | The Illumos code introduced the ASSERT0 and VERIFY0 macros which are to be used instead of ASSERT3S(x, ==, 0) and VERIFY3S(x, ==, 0). Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Madhav Suresh <[email protected]> Closes #246
* Fix --enable-debug-kmem-tracking optionTim Chase2013-06-181-7/+8
| | | | | | | | | | | | | | | Re-order initialization in spl_kmem_init to allow for kmem tracing to work. The spl_kmem_init function calls taskq_create prior to initializing the tracking (calling spl_kmem_init_tracking). Since taskq_create uses kmem_alloc, NULL dereferences occur because the global kmem_list hasn't had its next & prev pointers initialized yet. This commit moves the calls to spl_kmem_init_tracking earlier in the spl_kmem_init function in order that the subsequent kmem_alloc calls (by taskq_create) work properly. Signed-off-by: Brian Behlendorf <[email protected]> Closes #243
* Fix taskq_wait_id()Brian Behlendorf2013-05-031-26/+14
| | | | | | | | | | | | The existing taskq_wait_id() function can incorrectly block indefinitely. Reimplement it more simply using wait_event() in a similar fashion to taskq_wait_all(). This flaw was uncovered in the context of moving vn_rdwr() to a taskq. Previously taskq_wait_id() had no consumers outside the SPLAT task framework which is why the issue went unnoticed. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix delay()Brian Behlendorf2013-05-011-1/+1
| | | | | | | | | | | 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 <[email protected]>
* Add msec/usec/nsec to tick convertorsBrian Behlendorf2013-05-011-0/+5
| | | | | | | | | | Add wrappers for the Solaris MSEC_TO_TICK, USEC_TO_TICK, and NSEC_TO_TICK conversion functions. They are mapped directly to their Linux counterparts with the exception of NSEC_TO_TICK can cannot use usecs_to_jiffies() because it is not exported by the kernel. Signed-off-by: Brian Behlendorf <[email protected]>
* Ignore *.{deb,rpm,tar.gz} files in the top directory.Turbo Fredriksson2013-04-241-0/+3
| | | | | | | | These are build products and should be ignored. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Turbo Fredriksson <[email protected]> Issue zfsonlinux/zfs#1402
* Add --bump=0 to alienTurbo Fredriksson2013-04-241-2/+2
| | | | | | | | | | | | Preserve the release field when creating Debian packages. The --keep-version option was not used because it results in a failure when the git '<commit>_<hash>' syntax is used for the release. The '_' is a valid character for RPM packages but not for DEBs. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Turbo Fredriksson <[email protected]> Issue zfsonlinux/zfs#1402 Issue zfsonlinux/zfs#928
* Support .nogitrelease fileTurbo Fredriksson2013-04-241-1/+1
| | | | | | | | | When building a custom release in a git tree provide the ability to prevent the release field from being overwritten by the `git describe` output. Signed-off-by: Brian Behlendorf <[email protected]> Issue zfsonlinux/zfs#1402
* Fix various generic kmod RPM spec issues.Etienne Dechamps2013-04-241-6/+6
| | | | | | | | | | | | | | | | | | | There are a number of issues with the generic kmod RPM spec in its current state: - The "%{__id_u}" macro seems to not be available on some systems (e.g. Debian squeeze). It appears it has been deprecated. Use "${__id} -u" instead. - The way the "--with-linux=" configure option is generated in the non-RHEL/Fedora case is completely wrong with various newline and escaping issues (also, $kernel_version is not available in the generator context). The second issue made the generator shell snippet (almost) silently fail, which under specific circumstances can result in broken builds against the wrong kernel sources. Signed-off-by: Brian Behlendorf <[email protected]> Closes #231
* Add additional dependencies for DKMS packageBrian Behlendorf2013-04-021-0/+2
| | | | | | | | | | For the DKMS package to successfully build the kernel-devel headers must be included along gcc, make, and perl. The SPL code never directly invokes perl but the kernel build system depends on it. Signed-off-by: Brian Behlendorf <[email protected]> Issue zfsonlinux/zfs#1380
* Replace the SPL_AC_META perl dependency with awkBrian Behlendorf2013-04-021-30/+55
| | | | | | | | | The only remaining perl dependency is part of the SPL_AC_META macro. By eliminating this and replacing it with awk we can avoid the need to pull in perl to rebuild the packages. Signed-off-by: Brian Behlendorf <[email protected]> Issue zfsonlinux/zfs#1380
* Automake 1.10.1 compat: AM_SILENT_RULESBrian Behlendorf2013-04-021-1/+1
| | | | | | | | | | | | | | | | | | | Part of the automated testing involves building the source on Debian Lenny which ships an ancient version of automake (1.10.1). Historically, this has caused a non-fatal warning about AM_SILENT_RULES not being defined. But when the autogen.sh script was updated to use autoreconf the warning became fatal. configure.ac:31: warning: macro `AM_SILENT_RULES' not found in library autoreconf: running: /usr/bin/autoconf --force configure.ac:34: error: possibly undefined macro: AM_SILENT_RULES If this token and others are legitimate, please use m4_pattern_allow. To resolve this build issue the call to AM_SILENT_RULES has been wrapped by m4_ifdef(). This prevents the macro from being expanded on platforms where it's undefined. Signed-off-by: Brian Behlendorf <[email protected]>
* build: do not call boilerplate ourselfJan Engelhardt2013-04-024-5/+8
| | | | | | | | Rationale see section 3.5 "Using `autoreconf' to Update `configure' Scripts" of the autoconf manual. Signed-off-by: Jan Engelhardt <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* gitignore: anchor entries at their respective directoryJan Engelhardt2013-04-023-13/+14
| | | | | | | .ko is specific to module, .m4 to config, etc. Signed-off-by: Jan Engelhardt <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* build: use CPPFLAGSJan Engelhardt2013-04-021-1/+2
| | | | | | | | -D and -I are preprocessor flags, so should preferably be in the appropriate variable. Signed-off-by: Jan Engelhardt <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* build: resolve orthographic and other grammatical errorsJan Engelhardt2013-04-021-4/+4
| | | | | Signed-off-by: Jan Engelhardt <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Tag spl-0.6.1Brian Behlendorf2013-03-255-11/+10
| | | | | | META file and release log updated. Signed-off-by: Brian Behlendorf <[email protected]>
* Provide ${kmodname}-devel-kmod for yum-builddepBrian Behlendorf2013-03-251-1/+2
| | | | | | | | | | | | | | In order to ensure that yum-builddep pulls in all the build requirements a generic ${kmodname}-devel-kmod provides line is added. This allows a version of the development headers to be included without requiring knowledge of the kernel version. This is important because unlike rpmbuild which does correctly expand the source rpm spec file, yum-builddep does not. Without this generic provides line mock which relies on yum-builddep is unable to automatically satisfy the dependency. Signed-off-by: Brian Behlendorf <[email protected]>
* Use 'git describe' for working buildsBrian Behlendorf2013-03-222-4/+22
| | | | | | | | | | | | | | | | | | | When building from an arbitrary commit in the git tree it's useful for the resulting packages to be uniquely identifiable. Therefore, the build system has been updated to detect if your compiling in git tree. If you are building in a git tree, and there are commits after the last annotated tag. Then the <id>-<hash> component of 'git describe' will be used to overwrite the 'Release:' field in the META file. The only tricky part is that to ensure the 'make dist' tarball is built using the correct release. A dist-hook was added to the top level make file to rewrite the META file using the correct release. Signed-off-by: Brian Behlendorf <[email protected]> Closes #195 Issue #111
* Do not call cond_resched() in spl_slab_reclaim()Richard Yao2013-03-211-3/+0
| | | | | | | | | | 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 <[email protected]>